Class EmailMessage
An immutable, provider-agnostic email message. This is the payload exchanged between the framework, the middleware pipeline, and every IEmailProvider.
public sealed class EmailMessage
- Inheritance
-
EmailMessage
- Inherited Members
Constructors
EmailMessage(EmailAddress, IEnumerable<EmailRecipient>, string?, string?, string?, EmailPriority, IEnumerable<EmailAttachment>?, IDictionary<string, string>?, IDictionary<string, string>?, string?)
Creates a new message.
public EmailMessage(EmailAddress from, IEnumerable<EmailRecipient> recipients, string? subject, string? htmlBody = null, string? textBody = null, EmailPriority priority = EmailPriority.Normal, IEnumerable<EmailAttachment>? attachments = null, IDictionary<string, string>? headers = null, IDictionary<string, string>? tags = null, string? messageId = null)
Parameters
fromEmailAddressrecipientsIEnumerable<EmailRecipient>subjectstringhtmlBodystringtextBodystringpriorityEmailPriorityattachmentsIEnumerable<EmailAttachment>headersIDictionary<string, string>tagsIDictionary<string, string>messageIdstring
Properties
Attachments
Attachments and inline images.
public IReadOnlyList<EmailAttachment> Attachments { get; }
Property Value
BccRecipients
The blind-carbon-copy (Bcc) recipients.
public IReadOnlyList<EmailRecipient> BccRecipients { get; }
Property Value
CcRecipients
The carbon-copy (Cc) recipients.
public IReadOnlyList<EmailRecipient> CcRecipients { get; }
Property Value
CreatedAt
The time at which the message was created.
public DateTimeOffset CreatedAt { get; }
Property Value
From
The sender of the message.
public EmailAddress From { get; }
Property Value
Headers
Custom message headers.
public IReadOnlyDictionary<string, string> Headers { get; }
Property Value
HtmlBody
The HTML body (may be null when only a plain-text body is provided).
public string? HtmlBody { get; }
Property Value
MessageId
A unique identifier for this message (used by auditing and delivery tracking).
public string MessageId { get; }
Property Value
Priority
The message importance level.
public EmailPriority Priority { get; }
Property Value
Recipients
All recipients, each tagged with its role (To, Cc, or Bcc).
public IReadOnlyList<EmailRecipient> Recipients { get; }
Property Value
Subject
The message subject.
public string? Subject { get; }
Property Value
Tags
Arbitrary key/value tags used for routing and analytics.
public IReadOnlyDictionary<string, string> Tags { get; }
Property Value
TextBody
The plain-text body (may be null when only an HTML body is provided).
public string? TextBody { get; }
Property Value
ToRecipients
The primary (To) recipients.
public IReadOnlyList<EmailRecipient> ToRecipients { get; }
Property Value
Methods
Create()
Returns a fluent builder for constructing a message.
public static EmailMessageBuilder Create()