Class Email
Email entity (also known as EmailDto). When an SMTP email message is received by MailSlurp it is parsed. The body and attachments are written to disk and the fields such as to, from, subject etc are stored in a database. The body
contains the email content. If you want the original SMTP message see the getRawEmail
endpoints. The attachments can be fetched using the AttachmentController
Inherited Members
Namespace: mailslurp.Model
Assembly: mailslurp.dll
Syntax
[DataContract(Name = "Email")]
public class Email : IEquatable<Email>, IValidatableObject
Constructors
View SourceEmail()
Initializes a new instance of the Email class.
Declaration
[JsonConstructor]
protected Email()
Email(Guid, Guid, Guid, Guid?, List<string>, string, Sender, EmailRecipients, string, List<string>, List<string>, Dictionary<string, string>, Dictionary<string, List<string>>, List<string>, string, string, string, string, string, bool?, string, EmailAnalysis, DateTime, DateTime, bool, bool, bool?, List<string>, bool, bool)
Initializes a new instance of the Email class.
Declaration
public Email(Guid id = default, Guid userId = default, Guid inboxId = default, Guid? domainId = null, List<string> to = null, string from = null, Sender sender = null, EmailRecipients recipients = null, string replyTo = null, List<string> cc = null, List<string> bcc = null, Dictionary<string, string> headers = null, Dictionary<string, List<string>> headersMap = null, List<string> attachments = null, string subject = null, string body = null, string bodyExcerpt = null, string textExcerpt = null, string bodyMD5Hash = null, bool? isHTML = null, string charset = null, EmailAnalysis analysis = null, DateTime createdAt = default, DateTime updatedAt = default, bool read = false, bool teamAccess = false, bool? isXAmpHtml = null, List<string> bodyPartContentTypes = null, bool html = false, bool xampHtml = false)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | id | ID of the email entity (required). |
System.Guid | userId | ID of user that email belongs to (required). |
System.Guid | inboxId | ID of the inbox that received the email (required). |
System.Guid? | domainId | ID of the domain that received the email. |
System.Collections.Generic.List<T><string> | to | List of |
string | from | Who the email was sent from. An email address - see fromName for the sender name.. |
Sender | sender | sender. |
EmailRecipients | recipients | recipients. |
string | replyTo | The |
System.Collections.Generic.List<T><string> | cc | List of |
System.Collections.Generic.List<T><string> | bcc | List of |
Dictionary<string, string> | headers | Collection of SMTP headers attached to email. |
Dictionary<string, System.Collections.Generic.List<T><string>> | headersMap | Multi-value map of SMTP headers attached to email. |
System.Collections.Generic.List<T><string> | attachments | List of IDs of attachments found in the email. Use these IDs with the Inbox and Email Controllers to download attachments and attachment meta data such as filesize, name, extension.. |
string | subject | The subject line of the email message as specified by SMTP subject header. |
string | body | The body of the email message as text parsed from the SMTP message body (does not include attachments). Fetch the raw content to access the SMTP message and use the attachments property to access attachments. The body is stored separately to the email entity so the body is not returned in paginated results only in full single email or wait requests.. |
string | bodyExcerpt | An excerpt of the body of the email message for quick preview. Takes HTML content part if exists falls back to TEXT content part if not. |
string | textExcerpt | An excerpt of the body of the email message for quick preview. Takes TEXT content part if exists. |
string | bodyMD5Hash | A hash signature of the email message using MD5. Useful for comparing emails without fetching full body.. |
bool? | isHTML | Is the email body content type HTML?. |
string | charset | Detected character set of the email body such as UTF-8. |
EmailAnalysis | analysis | analysis. |
DateTime | createdAt | When was the email received by MailSlurp (required). |
DateTime | updatedAt | When was the email last updated (required). |
bool | read | Read flag. Has the email ever been viewed in the dashboard or fetched via the API with a hydrated body? If so the email is marked as read. Paginated results do not affect read status. Read status is different to email opened event as it depends on your own account accessing the email. Email opened is determined by tracking pixels sent to other uses if enable during sending. You can listened for both email read and email opened events using webhooks. (required). |
bool | teamAccess | Can the email be accessed by organization team members (required). |
bool? | isXAmpHtml | Is the email body content type x-amp-html Amp4Email?. |
System.Collections.Generic.List<T><string> | bodyPartContentTypes | A list of detected multipart mime message body part content types such as text/plain and text/html. Can be used with email bodyPart endpoints to fetch individual body parts.. |
bool | html | html. |
bool | xampHtml | xampHtml. |
Properties
View SourceAnalysis
Gets or Sets Analysis
Declaration
[DataMember(Name = "analysis", EmitDefaultValue = true)]
public EmailAnalysis Analysis { get; set; }
Property Value
Type | Description |
---|---|
EmailAnalysis |
Attachments
List of IDs of attachments found in the email. Use these IDs with the Inbox and Email Controllers to download attachments and attachment meta data such as filesize, name, extension.
Declaration
[DataMember(Name = "attachments", EmitDefaultValue = true)]
public List<string> Attachments { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<T><string> | List of IDs of attachments found in the email. Use these IDs with the Inbox and Email Controllers to download attachments and attachment meta data such as filesize, name, extension. |
Bcc
List of BCC
recipients email addresses that the email was addressed to. See recipients object for names.
Declaration
[DataMember(Name = "bcc", EmitDefaultValue = true)]
public List<string> Bcc { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<T><string> | List of |
Body
The body of the email message as text parsed from the SMTP message body (does not include attachments). Fetch the raw content to access the SMTP message and use the attachments property to access attachments. The body is stored separately to the email entity so the body is not returned in paginated results only in full single email or wait requests.
Declaration
[DataMember(Name = "body", EmitDefaultValue = true)]
public string Body { get; set; }
Property Value
Type | Description |
---|---|
string | The body of the email message as text parsed from the SMTP message body (does not include attachments). Fetch the raw content to access the SMTP message and use the attachments property to access attachments. The body is stored separately to the email entity so the body is not returned in paginated results only in full single email or wait requests. |
BodyExcerpt
An excerpt of the body of the email message for quick preview. Takes HTML content part if exists falls back to TEXT content part if not
Declaration
[DataMember(Name = "bodyExcerpt", EmitDefaultValue = true)]
public string BodyExcerpt { get; set; }
Property Value
Type | Description |
---|---|
string | An excerpt of the body of the email message for quick preview. Takes HTML content part if exists falls back to TEXT content part if not |
BodyMD5Hash
A hash signature of the email message using MD5. Useful for comparing emails without fetching full body.
Declaration
[DataMember(Name = "bodyMD5Hash", EmitDefaultValue = true)]
public string BodyMD5Hash { get; set; }
Property Value
Type | Description |
---|---|
string | A hash signature of the email message using MD5. Useful for comparing emails without fetching full body. |
BodyPartContentTypes
A list of detected multipart mime message body part content types such as text/plain and text/html. Can be used with email bodyPart endpoints to fetch individual body parts.
Declaration
[DataMember(Name = "bodyPartContentTypes", EmitDefaultValue = true)]
public List<string> BodyPartContentTypes { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<T><string> | A list of detected multipart mime message body part content types such as text/plain and text/html. Can be used with email bodyPart endpoints to fetch individual body parts. |
Cc
List of CC
recipients email addresses that the email was addressed to. See recipients object for names.
Declaration
[DataMember(Name = "cc", EmitDefaultValue = true)]
public List<string> Cc { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<T><string> | List of |
Charset
Detected character set of the email body such as UTF-8
Declaration
[DataMember(Name = "charset", EmitDefaultValue = true)]
public string Charset { get; set; }
Property Value
Type | Description |
---|---|
string | Detected character set of the email body such as UTF-8 |
CreatedAt
When was the email received by MailSlurp
Declaration
[DataMember(Name = "createdAt", IsRequired = true, EmitDefaultValue = true)]
public DateTime CreatedAt { get; set; }
Property Value
Type | Description |
---|---|
DateTime | When was the email received by MailSlurp |
DomainId
ID of the domain that received the email
Declaration
[DataMember(Name = "domainId", EmitDefaultValue = true)]
public Guid? DomainId { get; set; }
Property Value
Type | Description |
---|---|
System.Guid? | ID of the domain that received the email |
From
Who the email was sent from. An email address - see fromName for the sender name.
Declaration
[DataMember(Name = "from", EmitDefaultValue = true)]
public string From { get; set; }
Property Value
Type | Description |
---|---|
string | Who the email was sent from. An email address - see fromName for the sender name. |
Headers
Collection of SMTP headers attached to email
Declaration
[DataMember(Name = "headers", EmitDefaultValue = true)]
[Obsolete]
public Dictionary<string, string> Headers { get; set; }
Property Value
Type | Description |
---|---|
Dictionary<string, string> | Collection of SMTP headers attached to email |
HeadersMap
Multi-value map of SMTP headers attached to email
Declaration
[DataMember(Name = "headersMap", EmitDefaultValue = true)]
public Dictionary<string, List<string>> HeadersMap { get; set; }
Property Value
Type | Description |
---|---|
Dictionary<string, System.Collections.Generic.List<T><string>> | Multi-value map of SMTP headers attached to email |
Html
Gets or Sets Html
Declaration
[DataMember(Name = "html", EmitDefaultValue = true)]
public bool Html { get; set; }
Property Value
Type | Description |
---|---|
bool |
Id
ID of the email entity
Declaration
[DataMember(Name = "id", IsRequired = true, EmitDefaultValue = true)]
public Guid Id { get; set; }
Property Value
Type | Description |
---|---|
System.Guid | ID of the email entity |
InboxId
ID of the inbox that received the email
Declaration
[DataMember(Name = "inboxId", IsRequired = true, EmitDefaultValue = true)]
public Guid InboxId { get; set; }
Property Value
Type | Description |
---|---|
System.Guid | ID of the inbox that received the email |
IsHTML
Is the email body content type HTML?
Declaration
[DataMember(Name = "isHTML", EmitDefaultValue = true)]
public bool? IsHTML { get; set; }
Property Value
Type | Description |
---|---|
bool? | Is the email body content type HTML? |
IsXAmpHtml
Is the email body content type x-amp-html Amp4Email?
Declaration
[DataMember(Name = "isXAmpHtml", EmitDefaultValue = true)]
public bool? IsXAmpHtml { get; set; }
Property Value
Type | Description |
---|---|
bool? | Is the email body content type x-amp-html Amp4Email? |
Read
Read flag. Has the email ever been viewed in the dashboard or fetched via the API with a hydrated body? If so the email is marked as read. Paginated results do not affect read status. Read status is different to email opened event as it depends on your own account accessing the email. Email opened is determined by tracking pixels sent to other uses if enable during sending. You can listened for both email read and email opened events using webhooks.
Declaration
[DataMember(Name = "read", IsRequired = true, EmitDefaultValue = true)]
public bool Read { get; set; }
Property Value
Type | Description |
---|---|
bool | Read flag. Has the email ever been viewed in the dashboard or fetched via the API with a hydrated body? If so the email is marked as read. Paginated results do not affect read status. Read status is different to email opened event as it depends on your own account accessing the email. Email opened is determined by tracking pixels sent to other uses if enable during sending. You can listened for both email read and email opened events using webhooks. |
Recipients
Gets or Sets Recipients
Declaration
[DataMember(Name = "recipients", EmitDefaultValue = true)]
public EmailRecipients Recipients { get; set; }
Property Value
Type | Description |
---|---|
EmailRecipients |
ReplyTo
The replyTo
field on the received email message
Declaration
[DataMember(Name = "replyTo", EmitDefaultValue = true)]
public string ReplyTo { get; set; }
Property Value
Type | Description |
---|---|
string | The |
Sender
Gets or Sets Sender
Declaration
[DataMember(Name = "sender", EmitDefaultValue = true)]
public Sender Sender { get; set; }
Property Value
Type | Description |
---|---|
Sender |
Subject
The subject line of the email message as specified by SMTP subject header
Declaration
[DataMember(Name = "subject", EmitDefaultValue = true)]
public string Subject { get; set; }
Property Value
Type | Description |
---|---|
string | The subject line of the email message as specified by SMTP subject header |
TeamAccess
Can the email be accessed by organization team members
Declaration
[DataMember(Name = "teamAccess", IsRequired = true, EmitDefaultValue = true)]
public bool TeamAccess { get; set; }
Property Value
Type | Description |
---|---|
bool | Can the email be accessed by organization team members |
TextExcerpt
An excerpt of the body of the email message for quick preview. Takes TEXT content part if exists
Declaration
[DataMember(Name = "textExcerpt", EmitDefaultValue = true)]
public string TextExcerpt { get; set; }
Property Value
Type | Description |
---|---|
string | An excerpt of the body of the email message for quick preview. Takes TEXT content part if exists |
To
List of To
recipient email addresses that the email was addressed to. See recipients object for names.
Declaration
[DataMember(Name = "to", IsRequired = true, EmitDefaultValue = true)]
public List<string> To { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<T><string> | List of |
UpdatedAt
When was the email last updated
Declaration
[DataMember(Name = "updatedAt", IsRequired = true, EmitDefaultValue = true)]
public DateTime UpdatedAt { get; set; }
Property Value
Type | Description |
---|---|
DateTime | When was the email last updated |
UserId
ID of user that email belongs to
Declaration
[DataMember(Name = "userId", IsRequired = true, EmitDefaultValue = true)]
public Guid UserId { get; set; }
Property Value
Type | Description |
---|---|
System.Guid | ID of user that email belongs to |
XampHtml
Gets or Sets XampHtml
Declaration
[DataMember(Name = "xampHtml", EmitDefaultValue = true)]
public bool XampHtml { get; set; }
Property Value
Type | Description |
---|---|
bool |
Methods
View SourceEquals(Email)
Returns true if Email instances are equal
Declaration
public bool Equals(Email input)
Parameters
Type | Name | Description |
---|---|---|
input | Instance of Email 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 |