Click or drag to resize
MimeKit

MailTransportSendAsync Method (FormatOptions, MimeMessage, MailboxAddress, IEnumerableMailboxAddress, CancellationToken, ITransferProgress)

Asynchronously send the specified message using the supplied sender and recipients.

Namespace:  MailKit
Assembly:  MailKit (in MailKit.dll) Version: 2.3.0
Syntax
C#
public abstract Task SendAsync(
	FormatOptions options,
	MimeMessage message,
	MailboxAddress sender,
	IEnumerable<MailboxAddress> recipients,
	CancellationToken cancellationToken = null,
	ITransferProgress progress = null
)

Parameters

options
Type: MimeKitFormatOptions
The formatting options.
message
Type: MimeKitMimeMessage
The message.
sender
Type: MimeKitMailboxAddress
The mailbox address to use for sending the message.
recipients
Type: System.Collections.GenericIEnumerableMailboxAddress
The mailbox addresses that should receive the message.
cancellationToken (Optional)
Type: System.ThreadingCancellationToken
The cancellation token.
progress (Optional)
Type: MailKitITransferProgress
The progress reporting mechanism.

Return Value

Type: Task
An asynchronous task context.

Implements

IMailTransportSendAsync(FormatOptions, MimeMessage, MailboxAddress, IEnumerableMailboxAddress, CancellationToken, ITransferProgress)
Exceptions
ExceptionCondition
ArgumentNullException

options is null.

-or-

message is null.

-or-

sender is null.

-or-

recipients is null.

ObjectDisposedException The MailTransport has been disposed.
ServiceNotConnectedException The MailTransport is not connected.
ServiceNotAuthenticatedException Authentication is required before sending a message.
InvalidOperationException

A sender has not been specified.

-or-

No recipients have been specified.

OperationCanceledException The operation has been canceled.
NotSupportedException

Internationalized formatting was requested but is not supported by the transport.

IOException An I/O error occurred.
CommandException The send command failed.
ProtocolException A protocol exception occurred.
Remarks
Asynchronously sends the specified message using the supplied sender and recipients.
See Also