mailslurp/models/
send_email_options.rs

1/*
2 * MailSlurp API
3 *
4 * MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more.  ## Resources  - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://www.mailslurp.com/docs/) - [Examples](https://github.com/mailslurp/examples) repository
5 *
6 * The version of the OpenAPI document: 6.5.2
7 * 
8 * Generated by: https://openapi-generator.tech
9 */
10
11/// SendEmailOptions : Options for sending an email message from an inbox. You must provide one of: `to`, `toGroup`, or `toContacts` to send an email. All other parameters are optional. 
12
13
14
15#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
16pub struct SendEmailOptions {
17    /// Add tracking pixel to email
18    #[serde(rename = "addTrackingPixel", skip_serializing_if = "Option::is_none")]
19    pub add_tracking_pixel: Option<bool>,
20    /// Optional list of attachment IDs to send with this email. You must first upload each attachment separately via method call or dashboard in order to obtain attachment IDs. This way you can reuse attachments with different emails once uploaded. There are several ways to upload that support `multi-part form`, `base64 file encoding`, and octet stream binary uploads. See the `UploadController` for available methods. 
21    #[serde(rename = "attachments", skip_serializing_if = "Option::is_none")]
22    pub attachments: Option<Vec<String>>,
23    /// Optional list of bcc destination email addresses
24    #[serde(rename = "bcc", skip_serializing_if = "Option::is_none")]
25    pub bcc: Option<Vec<String>>,
26    /// Optional contents of email. If body contains HTML then set `isHTML` to true to ensure that email clients render it correctly. You can use moustache template syntax in the email body in conjunction with `toGroup` contact variables or `templateVariables` data. If you need more templating control consider creating a template and using the `template` property instead of the body.
27    #[serde(rename = "body", skip_serializing_if = "Option::is_none")]
28    pub body: Option<String>,
29    /// Optional list of cc destination email addresses
30    #[serde(rename = "cc", skip_serializing_if = "Option::is_none")]
31    pub cc: Option<Vec<String>>,
32    /// Optional charset
33    #[serde(rename = "charset", skip_serializing_if = "Option::is_none")]
34    pub charset: Option<String>,
35    /// Optional from address. Email address is RFC 5322 format and may include a display name and email in angle brackets (`my@address.com` or `My inbox <my@address.com>`). If no sender is set the source inbox address will be used for this field. If you set `useInboxName` to `true` the from field will include the inbox name as a display name: `inbox_name <inbox@address.com>`. For this to work use the name field when creating an inbox. Beware of potential spam penalties when setting the from field to an address not used by the inbox. Your emails may get blocked by services if you impersonate another address. To use a custom email addresses use a custom domain. You can create domains with the DomainController. The domain must be verified in the dashboard before it can be used.
36    #[serde(rename = "from", skip_serializing_if = "Option::is_none")]
37    pub from: Option<String>,
38    /// Optional HTML flag to indicate that contents is HTML. Set's a `content-type: text/html` for email. (Deprecated: use `isHTML` instead.)
39    #[serde(rename = "html", skip_serializing_if = "Option::is_none")]
40    pub html: Option<bool>,
41    /// Optional HTML flag. If true the `content-type` of the email will be `text/html`. Set to true when sending HTML to ensure proper rending on email clients
42    #[serde(rename = "isHTML", skip_serializing_if = "Option::is_none")]
43    pub is_html: Option<bool>,
44    /// Optional replyTo header
45    #[serde(rename = "replyTo", skip_serializing_if = "Option::is_none")]
46    pub reply_to: Option<String>,
47    /// Optional strategy to use when sending the email
48    #[serde(rename = "sendStrategy", skip_serializing_if = "Option::is_none")]
49    pub send_strategy: Option<SendStrategy>,
50    /// Optional email subject line
51    #[serde(rename = "subject", skip_serializing_if = "Option::is_none")]
52    pub subject: Option<String>,
53    /// Optional template ID to use for body. Will override body if provided. When using a template make sure you pass the corresponding map of `templateVariables`. You can find which variables are needed by fetching the template itself or viewing it in the dashboard.
54    #[serde(rename = "template", skip_serializing_if = "Option::is_none")]
55    pub template: Option<String>,
56    /// Optional map of template variables. Will replace moustache syntax variables in subject and body or template with the associated values if found.
57    #[serde(rename = "templateVariables", skip_serializing_if = "Option::is_none")]
58    pub template_variables: Option<serde_json::Value>,
59    /// List of destination email addresses. Each email address must be RFC 5322 format. Even single recipients must be in array form. Maximum recipients per email depends on your plan. If you need to send many emails try using contacts or contact groups or use a non standard sendStrategy to ensure that spam filters are not triggered (many recipients in one email can affect your spam rating). Be cautious when sending emails that your recipients exist. High bounce rates (meaning a high percentage of emails cannot be delivered because an address does not exist) can result in account freezing.
60    #[serde(rename = "to", skip_serializing_if = "Option::is_none")]
61    pub to: Option<Vec<String>>,
62    /// Optional list of contact IDs to send email to. Manage your contacts via the API or dashboard. When contacts are used the email is sent to each contact separately so they will not see other recipients.
63    #[serde(rename = "toContacts", skip_serializing_if = "Option::is_none")]
64    pub to_contacts: Option<Vec<String>>,
65    /// Optional contact group ID to send email to. You can create contacts and contact groups in the API or dashboard and use them for email campaigns. When contact groups are used the email is sent to each contact separately so they will not see other recipients
66    #[serde(rename = "toGroup", skip_serializing_if = "Option::is_none")]
67    pub to_group: Option<String>,
68    /// Use name of inbox as sender email address name. Will construct RFC 5322 email address with `Inbox name <inbox@address.com>` if the inbox has a name.
69    #[serde(rename = "useInboxName", skip_serializing_if = "Option::is_none")]
70    pub use_inbox_name: Option<bool>,
71}
72
73impl SendEmailOptions {
74    /// Options for sending an email message from an inbox. You must provide one of: `to`, `toGroup`, or `toContacts` to send an email. All other parameters are optional. 
75    pub fn new() -> SendEmailOptions {
76        SendEmailOptions {
77            add_tracking_pixel: None,
78            attachments: None,
79            bcc: None,
80            body: None,
81            cc: None,
82            charset: None,
83            from: None,
84            html: None,
85            is_html: None,
86            reply_to: None,
87            send_strategy: None,
88            subject: None,
89            template: None,
90            template_variables: None,
91            to: None,
92            to_contacts: None,
93            to_group: None,
94            use_inbox_name: None,
95        }
96    }
97}
98
99/// Optional strategy to use when sending the email
100#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
101pub enum SendStrategy {
102    #[serde(rename = "SINGLE_MESSAGE")]
103    SINGLEMESSAGE,
104}
105