Click or drag to resize
MimeKit

SmtpClientSendCommand Method

Send a custom command to the SMTP server.

Namespace:  MailKit.Net.Smtp
Assembly:  MailKit (in MailKit.dll) Version: 2.3.0
Syntax
C#
protected SmtpResponse SendCommand(
	string command,
	CancellationToken cancellationToken = null
)

Parameters

command
Type: SystemString
The command.
cancellationToken (Optional)
Type: System.ThreadingCancellationToken
The cancellation token.

Return Value

Type: SmtpResponse
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.
SmtpCommandException The SMTP command failed.
SmtpProtocolException An SMTP protocol exception occurred.
Remarks

Sends a custom command to the SMTP server.

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