Class EmailMessage
Represents an email message with sender, recipients, subject, body, and optional attachments.
Inheritance
Namespace: Umbraco.Cms.Core.Models.Email
Assembly: Umbraco.Core.dll
Syntax
public class EmailMessage
Constructors
View SourceEmailMessage(string?, string?, string?, string?, bool)
Initializes a new instance of the EmailMessage class with a single recipient.
Declaration
public EmailMessage(string? from, string? to, string? subject, string? body, bool isBodyHtml)
Parameters
| Type | Name | Description |
|---|---|---|
| string | from | The sender's email address. |
| string | to | The recipient's email address. |
| string | subject | The email subject. |
| string | body | The email body content. |
| bool | isBodyHtml | A value indicating whether the body is HTML formatted. |
EmailMessage(string?, string?[], string[]?, string[]?, string[]?, string?, string?, bool, IEnumerable<EmailMessageAttachment>?)
Initializes a new instance of the EmailMessage class with multiple recipients and optional CC, BCC, and reply-to addresses.
Declaration
public EmailMessage(string? from, string?[] to, string[]? cc, string[]? bcc, string[]? replyTo, string? subject, string? body, bool isBodyHtml, IEnumerable<EmailMessageAttachment>? attachments)
Parameters
| Type | Name | Description |
|---|---|---|
| string | from | The sender's email address. |
| string[] | to | The array of recipient email addresses. |
| string[] | cc | The array of CC email addresses. |
| string[] | bcc | The array of BCC email addresses. |
| string[] | replyTo | The array of reply-to email addresses. |
| string | subject | The email subject. |
| string | body | The email body content. |
| bool | isBodyHtml | A value indicating whether the body is HTML formatted. |
| IEnumerable<EmailMessageAttachment> | attachments | The collection of email attachments. |
Properties
View SourceAttachments
Gets the collection of email attachments.
Declaration
public IList<EmailMessageAttachment>? Attachments { get; }
Property Value
| Type | Description |
|---|---|
| IList<EmailMessageAttachment> |
Bcc
Gets the array of BCC email addresses.
Declaration
public string[]? Bcc { get; }
Property Value
| Type | Description |
|---|---|
| string[] |
Body
Gets the email body content.
Declaration
public string? Body { get; }
Property Value
| Type | Description |
|---|---|
| string |
Cc
Gets the array of CC email addresses.
Declaration
public string[]? Cc { get; }
Property Value
| Type | Description |
|---|---|
| string[] |
From
Gets the sender's email address.
Declaration
public string? From { get; }
Property Value
| Type | Description |
|---|---|
| string |
HasAttachments
Gets a value indicating whether the email has any attachments.
Declaration
public bool HasAttachments { get; }
Property Value
| Type | Description |
|---|---|
| bool |
IsBodyHtml
Gets a value indicating whether the body is HTML formatted.
Declaration
public bool IsBodyHtml { get; }
Property Value
| Type | Description |
|---|---|
| bool |
ReplyTo
Gets the array of reply-to email addresses.
Declaration
public string[]? ReplyTo { get; }
Property Value
| Type | Description |
|---|---|
| string[] |
Subject
Gets the email subject.
Declaration
public string? Subject { get; }
Property Value
| Type | Description |
|---|---|
| string |
To
Gets the array of recipient email addresses.
Declaration
public string?[] To { get; }
Property Value
| Type | Description |
|---|---|
| string[] |