Click or drag to resize
MimeKit

SmtpClientSendCommandAsync Method

Asynchronously send a custom command to the SMTP server.

Namespace: MailKit.Net.Smtp
Assembly: MailKit (in MailKit.dll) Version: 4.7.1
Syntax
C#
protected Task<SmtpResponse> SendCommandAsync(
	string command,
	CancellationToken cancellationToken = default
)

Parameters

command  String
The command.
cancellationToken  CancellationToken  (Optional)
The cancellation token.

Return Value

TaskSmtpResponse
The command response.
Exceptions
ExceptionCondition
ArgumentNullExceptioncommand is null.
ObjectDisposedException The SmtpClient has been disposed.
ServiceNotConnectedException The SmtpClient is not connected.
OperationCanceledException The operation has been canceled.
IOException An I/O error occurred.
SmtpProtocolException An SMTP protocol exception occurred.
Remarks

Asynchronously sends a custom command to the SMTP server.

Note  Note
The command string should not include the terminating \r\n sequence.
See Also