C# Class MailKit.Net.Smtp.SmtpClient

An SMTP client that can be used to send email messages.

The SmtpClient class supports both the "smtp" and "smtps" protocols. The "smtp" protocol makes a clear-text connection to the SMTP server and does not use SSL or TLS unless the SMTP server supports the STARTTLS extension. The "smtps" protocol, however, connects to the SMTP server using an SSL-wrapped connection.

The connection established by any of the Connect methods may be re-used if an application wishes to send multiple messages to the same SMTP server. Since connecting and authenticating can be expensive operations, re-using a connection can significantly improve performance when sending a large number of messages to the same SMTP server over a short period of time.

Inheritance: MailTransport
Show file Open project: jstedfast/MailKit Class Usage Examples

Private Properties

Property Type Description
AddUnique void
Bdat void
CheckDisposed void
ComputeDefaultValues void
Data void
Disconnect void
Ehlo void
FlushCommandQueue void
GetMessageRecipients IList
GetMessageSender MimeKit.MailboxAddress
GetNotifyString string
MailFrom void
ProcessMailFromResponse void
ProcessRcptToResponse bool
QueueCommand void
RcptTo void
ReplayConnect void
Reset void
Send void
SendCommand MailKit.Net.Smtp.SmtpResponse
SendEhlo MailKit.Net.Smtp.SmtpResponse
ValidateRemoteCertificate bool

Public Methods

Method Description
Authenticate ( Portable.Text.Encoding encoding, ICredentials credentials, CancellationToken cancellationToken = default(CancellationToken) ) : void

Authenticates using the supplied credentials.

If the SMTP server supports authentication, then the SASL mechanisms that both the client and server support are tried in order of greatest security to weakest security. Once a SASL authentication mechanism is found that both client and server support, the credentials are used to authenticate.

If, on the other hand, authentication is not supported by the SMTP server, then this method will throw System.NotSupportedException. The Capabilities property can be checked for the SmtpCapabilities.Authentication flag to make sure the SMTP server supports authentication before calling this method.

To prevent the usage of certain authentication mechanisms, simply remove them from the AuthenticationMechanisms hash set before calling this method.
Connect ( StreamSocket socket, string host, int port, SecureSocketOptions options = SecureSocketOptions.Auto, CancellationToken cancellationToken = default(CancellationToken) ) : void

Establish a connection to the specified SMTP or SMTP/S server using the provided socket.

Establishes a connection to the specified SMTP or SMTP/S server.

If the port has a value of 0, then the options parameter is used to determine the default port to connect to. The default port used with SecureSocketOptions.SslOnConnect is 465. All other values will use a default port of 25.

If the options has a value of SecureSocketOptions.Auto, then the port is used to determine the default security options. If the port has a value of 465, then the default options used will be SecureSocketOptions.SslOnConnect. All other values will use SecureSocketOptions.StartTlsWhenAvailable.

Once a connection is established, properties such as AuthenticationMechanisms and Capabilities will be populated.

The connection established by any of the Connect methods may be re-used if an application wishes to send multiple messages to the same SMTP server. Since connecting and authenticating can be expensive operations, re-using a connection can significantly improve performance when sending a large number of messages to the same SMTP server over a short period of time./
Connect ( string host, int port, SecureSocketOptions options = SecureSocketOptions.Auto, CancellationToken cancellationToken = default(CancellationToken) ) : void

Establishes a connection to the specified SMTP or SMTP/S server.

Establishes a connection to the specified SMTP or SMTP/S server.

If the port has a value of 0, then the options parameter is used to determine the default port to connect to. The default port used with SecureSocketOptions.SslOnConnect is 465. All other values will use a default port of 25.

If the options has a value of SecureSocketOptions.Auto, then the port is used to determine the default security options. If the port has a value of 465, then the default options used will be SecureSocketOptions.SslOnConnect. All other values will use SecureSocketOptions.StartTlsWhenAvailable.

Once a connection is established, properties such as AuthenticationMechanisms and Capabilities will be populated.

The connection established by any of the Connect methods may be re-used if an application wishes to send multiple messages to the same SMTP server. Since connecting and authenticating can be expensive operations, re-using a connection can significantly improve performance when sending a large number of messages to the same SMTP server over a short period of time.
Disconnect ( bool quit, CancellationToken cancellationToken = default(CancellationToken) ) : void

Disconnect the service.

If quit is true, a QUIT command will be issued in order to disconnect cleanly.

Expand ( string alias, CancellationToken cancellationToken = default(CancellationToken) ) : InternetAddressList

Expand a mailing address alias.

Expands a mailing address alias.

ExpandAsync ( string alias, CancellationToken cancellationToken = default(CancellationToken) ) : Task

Asynchronously expand a mailing address alias.

Asynchronously expands a mailing address alias.

NoOp ( CancellationToken cancellationToken = default(CancellationToken) ) : void

Ping the SMTP server to keep the connection alive.

Mail servers, if left idle for too long, will automatically drop the connection.

Send ( MimeKit.FormatOptions options, MimeMessage message, CancellationToken cancellationToken = default(CancellationToken), ITransferProgress progress = null ) : void

Send the specified message.

Sends the specified message.

The sender address is determined by checking the following message headers (in order of precedence): Resent-Sender, Resent-From, Sender, and From.

If either the Resent-Sender or Resent-From addresses are present, the recipients are collected from the Resent-To, Resent-Cc, and Resent-Bcc headers, otherwise the To, Cc, and Bcc headers are used.

Send ( MimeKit.FormatOptions options, MimeMessage message, MimeKit.MailboxAddress sender, IEnumerable recipients, CancellationToken cancellationToken = default(CancellationToken), ITransferProgress progress = null ) : void

Send the specified message using the supplied sender and recipients.

Sends the message by uploading it to an SMTP server using the supplied sender and recipients.

SmtpClient ( ) : System

Initializes a new instance of the MailKit.Net.Smtp.SmtpClient class.

Before you can send messages with the SmtpClient, you must first call one of the Connect methods. Depending on whether the SMTP server requires authenticating or not, you may also need to authenticate using one of the Authenticate methods.

SmtpClient ( IProtocolLogger protocolLogger ) : System

Initializes a new instance of the MailKit.Net.Smtp.SmtpClient class.

Before you can send messages with the SmtpClient, you must first call one of the Connect methods. Depending on whether the SMTP server requires authenticating or not, you may also need to authenticate using one of the Authenticate methods.

Verify ( string address, CancellationToken cancellationToken = default(CancellationToken) ) : MimeKit.MailboxAddress

Verify the existence of a mailbox address.

Verifies the existence a mailbox address with the SMTP server, returning the expanded mailbox address if it exists.

VerifyAsync ( string address, CancellationToken cancellationToken = default(CancellationToken) ) : Task

Asynchronously verify the existence of a mailbox address.

Asynchronously verifies the existence a mailbox address with the SMTP server, returning the expanded mailbox address if it exists.

Protected Methods

Method Description
Dispose ( bool disposing ) : void

Releases the unmanaged resources used by the SmtpClient and optionally releases the managed resources.

Releases the unmanaged resources used by the SmtpClient and optionally releases the managed resources.

GetDeliveryStatusNotifications ( MimeMessage message, MimeKit.MailboxAddress mailbox ) : DeliveryStatusNotification?

Get the types of delivery status notification desired for the specified recipient mailbox.

Gets the types of delivery status notification desired for the specified recipient mailbox.

GetEnvelopeId ( MimeMessage message ) : string

Get the envelope identifier to be used with delivery status notifications.

The envelope identifier, if non-empty, is useful in determining which message a delivery status notification was issued for.

The envelope identifier should be unique and may be up to 100 characters in length, but must consist only of printable ASCII characters and no white space.

For more information, see rfc3461, section 4.4.

OnNoRecipientsAccepted ( MimeMessage message ) : void

Invoked only when no recipients were accepted by the SMTP server.

If OnRecipientNotAccepted is overridden to not throw an exception, this method should be overridden to throw an appropriate exception instead.

OnRecipientAccepted ( MimeMessage message, MimeKit.MailboxAddress mailbox, MailKit.Net.Smtp.SmtpResponse response ) : void

Invoked when a recipient is accepted by the SMTP server.

The default implementation does nothing.

OnRecipientNotAccepted ( MimeMessage message, MimeKit.MailboxAddress mailbox, MailKit.Net.Smtp.SmtpResponse response ) : void

Invoked when a recipient is not accepted by the SMTP server.

The default implementation throws an appropriate SmtpCommandException.

OnSenderAccepted ( MimeMessage message, MimeKit.MailboxAddress mailbox, MailKit.Net.Smtp.SmtpResponse response ) : void

Invoked when the sender is accepted by the SMTP server.

The default implementation does nothing.

OnSenderNotAccepted ( MimeMessage message, MimeKit.MailboxAddress mailbox, MailKit.Net.Smtp.SmtpResponse response ) : void

Invoked when a recipient is not accepted by the SMTP server.

The default implementation throws an appropriate SmtpCommandException.

Private Methods

Method Description
AddUnique ( IList recipients, HashSet unique, IEnumerable mailboxes ) : void
Bdat ( MimeKit.FormatOptions options, MimeMessage message, CancellationToken cancellationToken, ITransferProgress progress ) : void
CheckDisposed ( ) : void
ComputeDefaultValues ( string host, int &port, SecureSocketOptions &options, Uri &uri, bool &starttls ) : void
Data ( MimeKit.FormatOptions options, MimeMessage message, CancellationToken cancellationToken, ITransferProgress progress ) : void
Disconnect ( ) : void
Ehlo ( CancellationToken cancellationToken ) : void
FlushCommandQueue ( MimeMessage message, MimeKit.MailboxAddress sender, IList recipients, CancellationToken cancellationToken ) : void
GetMessageRecipients ( MimeMessage message ) : IList
GetMessageSender ( MimeMessage message ) : MimeKit.MailboxAddress
GetNotifyString ( DeliveryStatusNotification notify ) : string
MailFrom ( MimeMessage message, MimeKit.MailboxAddress mailbox, SmtpExtension extensions, CancellationToken cancellationToken ) : void
ProcessMailFromResponse ( MimeMessage message, MimeKit.MailboxAddress mailbox, MailKit.Net.Smtp.SmtpResponse response ) : void
ProcessRcptToResponse ( MimeMessage message, MimeKit.MailboxAddress mailbox, MailKit.Net.Smtp.SmtpResponse response ) : bool
QueueCommand ( SmtpCommand type, string command, CancellationToken cancellationToken ) : void
RcptTo ( MimeMessage message, MimeKit.MailboxAddress mailbox, CancellationToken cancellationToken ) : void
ReplayConnect ( string hostName, Stream replayStream, CancellationToken cancellationToken = default(CancellationToken) ) : void
Reset ( CancellationToken cancellationToken ) : void
Send ( MimeKit.FormatOptions options, MimeMessage message, MimeKit.MailboxAddress sender, IList recipients, CancellationToken cancellationToken, ITransferProgress progress ) : void
SendCommand ( string command, CancellationToken cancellationToken ) : MailKit.Net.Smtp.SmtpResponse
SendEhlo ( bool ehlo, CancellationToken cancellationToken ) : MailKit.Net.Smtp.SmtpResponse
ValidateRemoteCertificate ( object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors ) : bool

Method Details

Authenticate() public method

Authenticates using the supplied credentials.

If the SMTP server supports authentication, then the SASL mechanisms that both the client and server support are tried in order of greatest security to weakest security. Once a SASL authentication mechanism is found that both client and server support, the credentials are used to authenticate.

If, on the other hand, authentication is not supported by the SMTP server, then this method will throw System.NotSupportedException. The Capabilities property can be checked for the SmtpCapabilities.Authentication flag to make sure the SMTP server supports authentication before calling this method.

To prevent the usage of certain authentication mechanisms, simply remove them from the AuthenticationMechanisms hash set before calling this method.
/// is null. /// -or- /// is null. /// /// The is not connected. /// /// The is already authenticated. /// /// The SMTP server does not support authentication. /// /// The operation was canceled via the cancellation token. /// /// Authentication using the supplied credentials has failed. /// /// A SASL authentication error occurred. /// /// An I/O error occurred. /// /// The SMTP command failed. /// /// An SMTP protocol error occurred. ///
public Authenticate ( Portable.Text.Encoding encoding, ICredentials credentials, CancellationToken cancellationToken = default(CancellationToken) ) : void
encoding Portable.Text.Encoding The text encoding to use for the user's credentials.
credentials ICredentials The user's credentials.
cancellationToken System.Threading.CancellationToken The cancellation token.
return void

Connect() public method

Establish a connection to the specified SMTP or SMTP/S server using the provided socket.

Establishes a connection to the specified SMTP or SMTP/S server.

If the port has a value of 0, then the options parameter is used to determine the default port to connect to. The default port used with SecureSocketOptions.SslOnConnect is 465. All other values will use a default port of 25.

If the options has a value of SecureSocketOptions.Auto, then the port is used to determine the default security options. If the port has a value of 465, then the default options used will be SecureSocketOptions.SslOnConnect. All other values will use SecureSocketOptions.StartTlsWhenAvailable.

Once a connection is established, properties such as AuthenticationMechanisms and Capabilities will be populated.

The connection established by any of the Connect methods may be re-used if an application wishes to send multiple messages to the same SMTP server. Since connecting and authenticating can be expensive operations, re-using a connection can significantly improve performance when sending a large number of messages to the same SMTP server over a short period of time./
/// is null. /// -or- /// is null. /// /// is not between 0 and 65535. /// /// is not connected. /// -or- /// The is a zero-length string. /// /// The has been disposed. /// /// The is already connected. /// /// was set to /// /// and the SMTP server does not support the STARTTLS extension. /// /// The operation was canceled. /// /// An I/O error occurred. /// /// An SMTP command failed. /// /// An SMTP protocol error occurred. ///
public Connect ( StreamSocket socket, string host, int port, SecureSocketOptions options = SecureSocketOptions.Auto, CancellationToken cancellationToken = default(CancellationToken) ) : void
socket Windows.Networking.Sockets.StreamSocket The socket to use for the connection.
host string The host name to connect to.
port int The port to connect to. If the specified port is 0, then the default port will be used.
options SecureSocketOptions The secure socket options to when connecting.
cancellationToken System.Threading.CancellationToken The cancellation token.
return void

Connect() public method

Establishes a connection to the specified SMTP or SMTP/S server.

Establishes a connection to the specified SMTP or SMTP/S server.

If the port has a value of 0, then the options parameter is used to determine the default port to connect to. The default port used with SecureSocketOptions.SslOnConnect is 465. All other values will use a default port of 25.

If the options has a value of SecureSocketOptions.Auto, then the port is used to determine the default security options. If the port has a value of 465, then the default options used will be SecureSocketOptions.SslOnConnect. All other values will use SecureSocketOptions.StartTlsWhenAvailable.

Once a connection is established, properties such as AuthenticationMechanisms and Capabilities will be populated.

The connection established by any of the Connect methods may be re-used if an application wishes to send multiple messages to the same SMTP server. Since connecting and authenticating can be expensive operations, re-using a connection can significantly improve performance when sending a large number of messages to the same SMTP server over a short period of time.
/// is null. /// /// is not between 0 and 65535. /// /// The is a zero-length string. /// /// The has been disposed. /// /// The is already connected. /// /// was set to /// /// and the SMTP server does not support the STARTTLS extension. /// /// The operation was canceled. /// /// A socket error occurred trying to connect to the remote host. /// /// An I/O error occurred. /// /// An SMTP command failed. /// /// An SMTP protocol error occurred. ///
public Connect ( string host, int port, SecureSocketOptions options = SecureSocketOptions.Auto, CancellationToken cancellationToken = default(CancellationToken) ) : void
host string The host name to connect to.
port int The port to connect to. If the specified port is 0, then the default port will be used.
options SecureSocketOptions The secure socket options to when connecting.
cancellationToken System.Threading.CancellationToken The cancellation token.
return void

Disconnect() public method

Disconnect the service.
If quit is true, a QUIT command will be issued in order to disconnect cleanly.
/// The has been disposed. ///
public Disconnect ( bool quit, CancellationToken cancellationToken = default(CancellationToken) ) : void
quit bool If set to true, a QUIT command will be issued in order to disconnect cleanly.
cancellationToken System.Threading.CancellationToken The cancellation token.
return void

Dispose() protected method

Releases the unmanaged resources used by the SmtpClient and optionally releases the managed resources.
Releases the unmanaged resources used by the SmtpClient and optionally releases the managed resources.
protected Dispose ( bool disposing ) : void
disposing bool true to release both managed and unmanaged resources; /// false to release only the unmanaged resources.
return void

Expand() public method

Expand a mailing address alias.
Expands a mailing address alias.
/// is null. /// /// is an empty string. /// /// The has been disposed. /// /// The is not connected. /// /// Authentication is required before verifying the existence of an address. /// /// The operation has been canceled. /// /// An I/O error occurred. /// /// The SMTP command failed. /// /// An SMTP protocol exception occurred. ///
public Expand ( string alias, CancellationToken cancellationToken = default(CancellationToken) ) : InternetAddressList
alias string The mailing address alias.
cancellationToken System.Threading.CancellationToken The cancellation token.
return InternetAddressList

ExpandAsync() public method

Asynchronously expand a mailing address alias.
Asynchronously expands a mailing address alias.
/// is null. /// /// is an empty string. /// /// The has been disposed. /// /// The is not connected. /// /// Authentication is required before verifying the existence of an address. /// /// The operation has been canceled. /// /// An I/O error occurred. /// /// The SMTP command failed. /// /// An SMTP protocol exception occurred. ///
public ExpandAsync ( string alias, CancellationToken cancellationToken = default(CancellationToken) ) : Task
alias string The mailing address alias.
cancellationToken System.Threading.CancellationToken The cancellation token.
return Task

GetDeliveryStatusNotifications() protected method

Get the types of delivery status notification desired for the specified recipient mailbox.
Gets the types of delivery status notification desired for the specified recipient mailbox.
protected GetDeliveryStatusNotifications ( MimeMessage message, MimeKit.MailboxAddress mailbox ) : DeliveryStatusNotification?
message MimeKit.MimeMessage The message being sent.
mailbox MimeKit.MailboxAddress The mailbox.
return DeliveryStatusNotification?

GetEnvelopeId() protected method

Get the envelope identifier to be used with delivery status notifications.

The envelope identifier, if non-empty, is useful in determining which message a delivery status notification was issued for.

The envelope identifier should be unique and may be up to 100 characters in length, but must consist only of printable ASCII characters and no white space.

For more information, see rfc3461, section 4.4.

protected GetEnvelopeId ( MimeMessage message ) : string
message MimeKit.MimeMessage The message.
return string

NoOp() public method

Ping the SMTP server to keep the connection alive.
Mail servers, if left idle for too long, will automatically drop the connection.
/// The has been disposed. /// /// The is not connected. /// /// The operation was canceled. /// /// An I/O error occurred. /// /// The SMTP command failed. /// /// An SMTP protocol error occurred. ///
public NoOp ( CancellationToken cancellationToken = default(CancellationToken) ) : void
cancellationToken System.Threading.CancellationToken The cancellation token.
return void

OnNoRecipientsAccepted() protected method

Invoked only when no recipients were accepted by the SMTP server.
If OnRecipientNotAccepted is overridden to not throw an exception, this method should be overridden to throw an appropriate exception instead.
protected OnNoRecipientsAccepted ( MimeMessage message ) : void
message MimeKit.MimeMessage The message being sent.
return void

OnRecipientAccepted() protected method

Invoked when a recipient is accepted by the SMTP server.
The default implementation does nothing.
protected OnRecipientAccepted ( MimeMessage message, MimeKit.MailboxAddress mailbox, MailKit.Net.Smtp.SmtpResponse response ) : void
message MimeKit.MimeMessage The message being sent.
mailbox MimeKit.MailboxAddress The mailbox used in the RCPT TO command.
response MailKit.Net.Smtp.SmtpResponse The response to the RCPT TO command.
return void

OnRecipientNotAccepted() protected method

Invoked when a recipient is not accepted by the SMTP server.
The default implementation throws an appropriate SmtpCommandException.
protected OnRecipientNotAccepted ( MimeMessage message, MimeKit.MailboxAddress mailbox, MailKit.Net.Smtp.SmtpResponse response ) : void
message MimeKit.MimeMessage The message being sent.
mailbox MimeKit.MailboxAddress The mailbox used in the RCPT TO command.
response MailKit.Net.Smtp.SmtpResponse The response to the RCPT TO command.
return void

OnSenderAccepted() protected method

Invoked when the sender is accepted by the SMTP server.
The default implementation does nothing.
protected OnSenderAccepted ( MimeMessage message, MimeKit.MailboxAddress mailbox, MailKit.Net.Smtp.SmtpResponse response ) : void
message MimeKit.MimeMessage The message being sent.
mailbox MimeKit.MailboxAddress The mailbox used in the MAIL FROM command.
response MailKit.Net.Smtp.SmtpResponse The response to the MAIL FROM command.
return void

OnSenderNotAccepted() protected method

Invoked when a recipient is not accepted by the SMTP server.
The default implementation throws an appropriate SmtpCommandException.
protected OnSenderNotAccepted ( MimeMessage message, MimeKit.MailboxAddress mailbox, MailKit.Net.Smtp.SmtpResponse response ) : void
message MimeKit.MimeMessage The message being sent.
mailbox MimeKit.MailboxAddress The mailbox used in the MAIL FROM command.
response MailKit.Net.Smtp.SmtpResponse The response to the MAIL FROM command.
return void

Send() public method

Send the specified message.

Sends the specified message.

The sender address is determined by checking the following message headers (in order of precedence): Resent-Sender, Resent-From, Sender, and From.

If either the Resent-Sender or Resent-From addresses are present, the recipients are collected from the Resent-To, Resent-Cc, and Resent-Bcc headers, otherwise the To, Cc, and Bcc headers are used.

/// is null. /// -or- /// is null. /// /// The has been disposed. /// /// The is not connected. /// /// Authentication is required before sending a message. /// /// A sender has not been specified. /// -or- /// No recipients have been specified. /// /// Internationalized formatting was requested but is not supported by the server. /// /// The operation has been canceled. /// /// An I/O error occurred. /// /// The SMTP command failed. /// /// An SMTP protocol exception occurred. ///
public Send ( MimeKit.FormatOptions options, MimeMessage message, CancellationToken cancellationToken = default(CancellationToken), ITransferProgress progress = null ) : void
options MimeKit.FormatOptions The formatting options.
message MimeKit.MimeMessage The message.
cancellationToken System.Threading.CancellationToken The cancellation token.
progress ITransferProgress The progress reporting mechanism.
return void

Send() public method

Send the specified message using the supplied sender and recipients.
Sends the message by uploading it to an SMTP server using the supplied sender and recipients.
/// is null. /// -or- /// is null. /// -or- /// is null. /// -or- /// is null. /// /// The has been disposed. /// /// The is not connected. /// /// Authentication is required before sending a message. /// /// A sender has not been specified. /// -or- /// No recipients have been specified. /// /// Internationalized formatting was requested but is not supported by the server. /// /// The operation has been canceled. /// /// An I/O error occurred. /// /// The SMTP command failed. /// /// An SMTP protocol exception occurred. ///
public Send ( MimeKit.FormatOptions options, MimeMessage message, MimeKit.MailboxAddress sender, IEnumerable recipients, CancellationToken cancellationToken = default(CancellationToken), ITransferProgress progress = null ) : void
options MimeKit.FormatOptions The formatting options.
message MimeKit.MimeMessage The message.
sender MimeKit.MailboxAddress The mailbox address to use for sending the message.
recipients IEnumerable The mailbox addresses that should receive the message.
cancellationToken System.Threading.CancellationToken The cancellation token.
progress ITransferProgress The progress reporting mechanism.
return void

SmtpClient() public method

Initializes a new instance of the MailKit.Net.Smtp.SmtpClient class.
Before you can send messages with the SmtpClient, you must first call one of the Connect methods. Depending on whether the SMTP server requires authenticating or not, you may also need to authenticate using one of the Authenticate methods.
public SmtpClient ( ) : System
return System

SmtpClient() public method

Initializes a new instance of the MailKit.Net.Smtp.SmtpClient class.
Before you can send messages with the SmtpClient, you must first call one of the Connect methods. Depending on whether the SMTP server requires authenticating or not, you may also need to authenticate using one of the Authenticate methods.
/// is null. ///
public SmtpClient ( IProtocolLogger protocolLogger ) : System
protocolLogger IProtocolLogger The protocol logger.
return System

Verify() public method

Verify the existence of a mailbox address.
Verifies the existence a mailbox address with the SMTP server, returning the expanded mailbox address if it exists.
/// is null. /// /// is an empty string. /// /// The has been disposed. /// /// The is not connected. /// /// Authentication is required before verifying the existence of an address. /// /// The operation has been canceled. /// /// An I/O error occurred. /// /// The SMTP command failed. /// /// An SMTP protocol exception occurred. ///
public Verify ( string address, CancellationToken cancellationToken = default(CancellationToken) ) : MimeKit.MailboxAddress
address string The mailbox address.
cancellationToken System.Threading.CancellationToken The cancellation token.
return MimeKit.MailboxAddress

VerifyAsync() public method

Asynchronously verify the existence of a mailbox address.
Asynchronously verifies the existence a mailbox address with the SMTP server, returning the expanded mailbox address if it exists.
/// is null. /// /// is an empty string. /// /// The has been disposed. /// /// The is not connected. /// /// Authentication is required before verifying the existence of an address. /// /// The operation has been canceled. /// /// An I/O error occurred. /// /// The SMTP command failed. /// /// An SMTP protocol exception occurred. ///
public VerifyAsync ( string address, CancellationToken cancellationToken = default(CancellationToken) ) : Task
address string The mailbox address.
cancellationToken System.Threading.CancellationToken The cancellation token.
return Task