Class SendEmailOptions
Options for the email to be sent
Inherited Members
Namespace: mailslurp.Model
Assembly: mailslurp.dll
Syntax
[DataContract(Name = "SendEmailOptions")]
public class SendEmailOptions : IEquatable<SendEmailOptions>, IValidatableObject
Constructors
View SourceSendEmailOptions(List<Guid?>, Guid?, List<string>, string, List<string>, List<string>, string, string, Dictionary<string, string>, string, bool?, bool?, string, List<string>, Dictionary<string, object>, Guid?, SendStrategyEnum?, bool?, bool?, bool?, ValidateEmailAddressesEnum?, bool?, bool?, List<SendEmailBodyPart>)
Initializes a new instance of the SendEmailOptions class.
Declaration
public SendEmailOptions(List<Guid?> toContacts = null, Guid? toGroup = null, List<string> to = null, string from = null, List<string> cc = null, List<string> bcc = null, string subject = null, string replyTo = null, Dictionary<string, string> customHeaders = null, string body = null, bool? html = null, bool? isHTML = null, string charset = null, List<string> attachments = null, Dictionary<string, object> templateVariables = null, Guid? template = null, SendEmailOptions.SendStrategyEnum? sendStrategy = null, bool? useInboxName = null, bool? addTrackingPixel = null, bool? filterBouncedRecipients = null, SendEmailOptions.ValidateEmailAddressesEnum? validateEmailAddresses = null, bool? ignoreEmptyRecipients = null, bool? isXAmpHtml = null, List<SendEmailBodyPart> bodyParts = null)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.List<T><System.Guid?> | toContacts | 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.. |
System.Guid? | toGroup | 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. |
System.Collections.Generic.List<T><string> | to | 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.. |
string | from | Optional from address. Email address is RFC 5322 format and may include a display name and email in angle brackets ( |
System.Collections.Generic.List<T><string> | cc | Optional list of cc destination email addresses. |
System.Collections.Generic.List<T><string> | bcc | Optional list of bcc destination email addresses. |
string | subject | Optional email subject line. |
string | replyTo | Optional replyTo header. |
Dictionary<string, string> | customHeaders | Optional custom headers. |
string | body | Optional contents of email. If body contains HTML then set |
bool? | html | Optional HTML flag to indicate that contents is HTML. Set's a |
bool? | isHTML | Optional HTML flag. If true the |
string | charset | Optional charset. |
System.Collections.Generic.List<T><string> | attachments | 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 |
Dictionary<string, object> | templateVariables | Optional map of template variables. Will replace moustache syntax variables in subject and body or template with the associated values if found.. |
System.Guid? | template | Optional template ID to use for body. Will override body if provided. When using a template make sure you pass the corresponding map of |
SendEmailOptions.SendStrategyEnum? | sendStrategy | How an email should be sent based on its recipients. |
bool? | useInboxName | Use name of inbox as sender email address name. Will construct RFC 5322 email address with |
bool? | addTrackingPixel | Add tracking pixel to email. |
bool? | filterBouncedRecipients | Filter recipients to remove any bounced recipients from to, bcc, and cc before sending. |
SendEmailOptions.ValidateEmailAddressesEnum? | validateEmailAddresses | Validate recipient email addresses before sending. |
bool? | ignoreEmptyRecipients | Ignore empty recipients after validation removes all recipients as invalid and fail silently. |
bool? | isXAmpHtml | Is content AMP4EMAIL compatible. If set will send as x-amp-html part.. |
System.Collections.Generic.List<T><SendEmailBodyPart> | bodyParts | Email body content parts for multipart mime message. Will override body.. |
Properties
View SourceAddTrackingPixel
Add tracking pixel to email
Declaration
[DataMember(Name = "addTrackingPixel", EmitDefaultValue = true)]
public bool? AddTrackingPixel { get; set; }
Property Value
Type | Description |
---|---|
bool? | Add tracking pixel to email |
Attachments
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.
Declaration
[DataMember(Name = "attachments", EmitDefaultValue = true)]
public List<string> Attachments { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<T><string> | 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 |
Bcc
Optional list of bcc destination email addresses
Declaration
[DataMember(Name = "bcc", EmitDefaultValue = true)]
public List<string> Bcc { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<T><string> | Optional list of bcc destination email addresses |
Body
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.
Declaration
[DataMember(Name = "body", EmitDefaultValue = true)]
public string Body { get; set; }
Property Value
Type | Description |
---|---|
string | Optional contents of email. If body contains HTML then set |
BodyParts
Email body content parts for multipart mime message. Will override body.
Declaration
[DataMember(Name = "bodyParts", EmitDefaultValue = true)]
public List<SendEmailBodyPart> BodyParts { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<T><SendEmailBodyPart> | Email body content parts for multipart mime message. Will override body. |
Cc
Optional list of cc destination email addresses
Declaration
[DataMember(Name = "cc", EmitDefaultValue = true)]
public List<string> Cc { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<T><string> | Optional list of cc destination email addresses |
Charset
Optional charset
Declaration
[DataMember(Name = "charset", EmitDefaultValue = true)]
public string Charset { get; set; }
Property Value
Type | Description |
---|---|
string | Optional charset |
CustomHeaders
Optional custom headers
Declaration
[DataMember(Name = "customHeaders", EmitDefaultValue = true)]
public Dictionary<string, string> CustomHeaders { get; set; }
Property Value
Type | Description |
---|---|
Dictionary<string, string> | Optional custom headers |
FilterBouncedRecipients
Filter recipients to remove any bounced recipients from to, bcc, and cc before sending
Declaration
[DataMember(Name = "filterBouncedRecipients", EmitDefaultValue = true)]
public bool? FilterBouncedRecipients { get; set; }
Property Value
Type | Description |
---|---|
bool? | Filter recipients to remove any bounced recipients from to, bcc, and cc before sending |
From
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.
Declaration
[DataMember(Name = "from", EmitDefaultValue = true)]
public string From { get; set; }
Property Value
Type | Description |
---|---|
string | Optional from address. Email address is RFC 5322 format and may include a display name and email in angle brackets ( |
Html
Optional HTML flag to indicate that contents is HTML. Set's a content-type: text/html
for email. (Deprecated: use isHTML
instead.)
Declaration
[DataMember(Name = "html", EmitDefaultValue = true)]
public bool? Html { get; set; }
Property Value
Type | Description |
---|---|
bool? | Optional HTML flag to indicate that contents is HTML. Set's a |
IgnoreEmptyRecipients
Ignore empty recipients after validation removes all recipients as invalid and fail silently
Declaration
[DataMember(Name = "ignoreEmptyRecipients", EmitDefaultValue = true)]
public bool? IgnoreEmptyRecipients { get; set; }
Property Value
Type | Description |
---|---|
bool? | Ignore empty recipients after validation removes all recipients as invalid and fail silently |
IsHTML
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
Declaration
[DataMember(Name = "isHTML", EmitDefaultValue = true)]
public bool? IsHTML { get; set; }
Property Value
Type | Description |
---|---|
bool? | Optional HTML flag. If true the |
IsXAmpHtml
Is content AMP4EMAIL compatible. If set will send as x-amp-html part.
Declaration
[DataMember(Name = "isXAmpHtml", EmitDefaultValue = true)]
public bool? IsXAmpHtml { get; set; }
Property Value
Type | Description |
---|---|
bool? | Is content AMP4EMAIL compatible. If set will send as x-amp-html part. |
ReplyTo
Optional replyTo header
Declaration
[DataMember(Name = "replyTo", EmitDefaultValue = true)]
public string ReplyTo { get; set; }
Property Value
Type | Description |
---|---|
string | Optional replyTo header |
SendStrategy
How an email should be sent based on its recipients
Declaration
[DataMember(Name = "sendStrategy", EmitDefaultValue = true)]
public SendEmailOptions.SendStrategyEnum? SendStrategy { get; set; }
Property Value
Type | Description |
---|---|
SendEmailOptions.SendStrategyEnum? | How an email should be sent based on its recipients |
Subject
Optional email subject line
Declaration
[DataMember(Name = "subject", EmitDefaultValue = true)]
public string Subject { get; set; }
Property Value
Type | Description |
---|---|
string | Optional email subject line |
Template
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.
Declaration
[DataMember(Name = "template", EmitDefaultValue = true)]
public Guid? Template { get; set; }
Property Value
Type | Description |
---|---|
System.Guid? | 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
Optional map of template variables. Will replace moustache syntax variables in subject and body or template with the associated values if found.
Declaration
[DataMember(Name = "templateVariables", EmitDefaultValue = true)]
public Dictionary<string, object> TemplateVariables { get; set; }
Property Value
Type | Description |
---|---|
Dictionary<string, object> | Optional map of template variables. Will replace moustache syntax variables in subject and body or template with the associated values if found. |
To
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.
Declaration
[DataMember(Name = "to", EmitDefaultValue = true)]
public List<string> To { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<T><string> | 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. |
ToContacts
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.
Declaration
[DataMember(Name = "toContacts", EmitDefaultValue = true)]
public List<Guid?> ToContacts { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<T><System.Guid?> | 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. |
ToGroup
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
Declaration
[DataMember(Name = "toGroup", EmitDefaultValue = true)]
public Guid? ToGroup { get; set; }
Property Value
Type | Description |
---|---|
System.Guid? | 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 |
UseInboxName
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.
Declaration
[DataMember(Name = "useInboxName", EmitDefaultValue = true)]
public bool? UseInboxName { get; set; }
Property Value
Type | Description |
---|---|
bool? | Use name of inbox as sender email address name. Will construct RFC 5322 email address with |
ValidateEmailAddresses
Validate recipient email addresses before sending
Declaration
[DataMember(Name = "validateEmailAddresses", EmitDefaultValue = true)]
public SendEmailOptions.ValidateEmailAddressesEnum? ValidateEmailAddresses { get; set; }
Property Value
Type | Description |
---|---|
SendEmailOptions.ValidateEmailAddressesEnum? | Validate recipient email addresses before sending |
Methods
View SourceEquals(SendEmailOptions)
Returns true if SendEmailOptions instances are equal
Declaration
public bool Equals(SendEmailOptions input)
Parameters
Type | Name | Description |
---|---|---|
SendEmailOptions | input | Instance of SendEmailOptions to be compared |
Returns
Type | Description |
---|---|
bool | Boolean |
Equals(object)
Returns true if objects are equal
Declaration
public override bool Equals(object input)
Parameters
Type | Name | Description |
---|---|---|
object | input | Object to be compared |
Returns
Type | Description |
---|---|
bool | Boolean |
Overrides
View SourceGetHashCode()
Gets the hash code
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
int | Hash code |
Overrides
View SourceToJson()
Returns the JSON string presentation of the object
Declaration
public virtual string ToJson()
Returns
Type | Description |
---|---|
string | JSON string presentation of the object |
ToString()
Returns the string presentation of the object
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string | String presentation of the object |
Overrides
Validate(ValidationContext)
To validate all properties of the instance
Declaration
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
Parameters
Type | Name | Description |
---|---|---|
ValidationContext | validationContext | Validation context |
Returns
Type | Description |
---|---|
IEnumerable<ValidationResult> | Validation Result |