Click or drag to resize
MimeKit

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

Send the specified message using the supplied sender and recipients.

Namespace: MailKit.Net.Smtp
Assembly: MailKit (in MailKit.dll) Version: 4.7.1
Syntax
C#
public override string Send(
	FormatOptions options,
	MimeMessage message,
	MailboxAddress sender,
	IEnumerable<MailboxAddress> recipients,
	CancellationToken cancellationToken = default,
	ITransferProgress progress = null
)

Parameters

options  FormatOptions
The formatting options.
message  MimeMessage
The message.
sender  MailboxAddress
The mailbox address to use for sending the message.
recipients  IEnumerableMailboxAddress
The mailbox addresses that should receive the message.
cancellationToken  CancellationToken  (Optional)
The cancellation token.
progress  ITransferProgress  (Optional)
The progress reporting mechanism.

Return Value

String
The final free-form text response from the server.

Implements

IMailTransportSend(FormatOptions, MimeMessage, MailboxAddress, IEnumerableMailboxAddress, CancellationToken, ITransferProgress)
IMailTransportSend(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 SmtpClient has been disposed.
ServiceNotConnectedException The SmtpClient is not connected.
ServiceNotAuthenticatedException Authentication is required before sending a message.
InvalidOperationException

A sender has not been specified.

-or-

No recipients have been specified.

NotSupportedException Internationalized formatting was requested but is not supported by the server.
OperationCanceledException The operation has been canceled.
IOException An I/O error occurred.
SmtpCommandException The SMTP command failed.
SmtpProtocolException An SMTP protocol exception occurred.
Remarks
Sends the message by uploading it to an SMTP server using the supplied sender and recipients.
See Also