SmtpClientSendCommand Method

Send a custom command to the SMTP server.

Definition

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

Parameters

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

Return Value

SmtpResponse
The command response.

Remarks

Sends a custom command to the SMTP server.

  Note

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

Exceptions

ArgumentNullException command is .
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.

See Also