Table of Contents

Class MailMessage

Namespace
NuvTools.Notification.Mail
Assembly
NuvTools.Notification.Mail.dll

Represents an email message with sender, recipients, subject, body, and optional attachments.

public class MailMessage
Inheritance
MailMessage
Inherited Members

Remarks

This class serves as the abstraction for composing email messages across different mail providers. It supports HTML body content and optional attachments through the Parts property. Features not supported by every provider (Tags, ScheduledFor) are declared here so the application layer never depends on a provider specific package. Implementations that cannot honor them throw NotSupportedException rather than silently ignoring the request.

Properties

Body

Gets or sets the body content of the email. This is typically HTML content that will be rendered by the email client.

public required string Body { get; set; }

Property Value

string

From

Gets or sets the sender's email address.

public required MailAddress From { get; set; }

Property Value

MailAddress

Headers

Gets or sets the optional custom email headers.

public IDictionary<string, string>? Headers { get; set; }

Property Value

IDictionary<string, string>

Remarks

Standard headers such as To, From, Subject, Reply-To, CC and BCC cannot be overridden.

Parts

Gets or sets the optional list of attachments to include with the email.

public List<MailPart>? Parts { get; set; }

Property Value

List<MailPart>

ScheduledFor

Gets or sets the optional date and time when the email should be delivered.

public DateTimeOffset? ScheduledFor { get; set; }

Property Value

DateTimeOffset?

Remarks

When null, the email is sent immediately. Providers with no scheduling support throw NotSupportedException instead of delivering the message immediately.

Subject

Gets or sets the subject line of the email.

public required string Subject { get; set; }

Property Value

string

Tags

Gets or sets the optional custom metadata used by the provider for filtering and tracking.

public IDictionary<string, string>? Tags { get; set; }

Property Value

IDictionary<string, string>

Remarks

Tags are not transmitted to the recipient. Providers with no equivalent concept throw NotSupportedException.

TextBody

Gets or sets the optional plain text version of the body.

public string? TextBody { get; set; }

Property Value

string

Remarks

Used by email clients that cannot render HTML. Providers that generate it automatically from Body do so only when this property is not informed.

To

Gets or sets the list of recipient email addresses.

public required List<MailAddress> To { get; set; }

Property Value

List<MailAddress>