MailOptions
Everything about a send other than the message itself: recipients, copies, reply-to, attachments, and the idempotency key.
An options object rather than a growing parameter list, so adding a capability does not change SendAsync. The single-recipient overload builds one of these for you.
Fields
To: IReadOnlyList<string>
Recipients. Must not be empty; a send with no recipient fails without calling Resend.
Cc: IReadOnlyList<string>
Carbon-copy recipients.
Default: []
Bcc: IReadOnlyList<string>
Blind carbon-copy recipients.
Default: []
ReplyTo: IReadOnlyList<string>
Addresses a reply should go to instead of the configured sender.
Default: []
Attachments: IReadOnlyList<MailAttachment>
Files delivered with the message, as MailAttachment values. Each one is held in memory for the duration of the send.
Default: []
IdempotencyKey: string?
Key Resend uses to collapse duplicate sends. One is generated per send when this is null, so the resilience handler's retries cannot deliver twice. Set it when the whole operation is itself retryable, such as a background job.
Default: null
Type signature
public sealed record MailOptions
{
public required IReadOnlyList<string> To { get; init; }
public IReadOnlyList<string> Cc { get; init; }
public IReadOnlyList<string> Bcc { get; init; }
public IReadOnlyList<string> ReplyTo { get; init; }
public IReadOnlyList<MailAttachment> Attachments { get; init; }
public string? IdempotencyKey { get; init; }
}