pub struct EmailsResource<'a> { /* private fields */ }Expand description
client.emails()
Implementations§
Source§impl<'a> EmailsResource<'a>
impl<'a> EmailsResource<'a>
Sourcepub fn placeholder_statistics(
&self,
body: &EmailPlaceholderStatisticsCreate,
) -> Result<Vec<EmailPlaceholderStatistics>>
pub fn placeholder_statistics( &self, body: &EmailPlaceholderStatisticsCreate, ) -> Result<Vec<EmailPlaceholderStatistics>>
Get email placeholder statistics
POST /emails/placeholderstatistics
Renders placeholder statistics for the visible subset of personIds without sending emails. Content fragments are concatenated, optionally inserted into an accessible HTML template, then evaluated for each person. Missing/inaccessible recipients are omitted; if none are visible, the request returns 404. Without placeholder-like syntax in the resulting text, data is empty even when recipients were supplied. Results follow the loaded recipient order, not necessarily the input order; correlate by personId. Stats report availability of evaluated placeholders, not their values or occurrence counts. A subject is not part of this request. The automaticEmailId parameter currently has no effect.
§Example
let body = models::EmailPlaceholderStatisticsCreate {
content: vec!["Hello {{person.firstName}}".into()],
person_ids: vec![1, 2],
..Default::default()
};
for email in client.emails().placeholder_statistics(&body)? {
println!("{}", email.person_id);
}Sourcepub fn preview(&self, body: &EmailPreviewCreate) -> Result<EmailPreview>
pub fn preview(&self, body: &EmailPreviewCreate) -> Result<EmailPreview>
Render an email preview
POST /emails/preview
Renders content and an optional subject for one person visible to the caller. No email is sent and no draft is saved. Content fragments are concatenated without separators; an optional template replaces its {{body}} tokens before placeholder expansion. groupId adds group and membership context and requires access to that group. The HTML template requires template-view permission, or permission to view automatic emails for the supplied group. Missing or inaccessible recipients return 404. The flat response always contains html and contains subject only when supplied. userId selects a placeholder acting context rather than a recipient and is handled differently by individual decorators; it is not an authenticated-user switch for the whole request.
§Example
let body = models::EmailPreviewCreate {
content: vec!["Hello {{person.firstName}}".into()],
person_id: 1,
..Default::default()
};
let email = client.emails().preview(&body)?;
println!("{}", email.html);