SocketTools .NET Edition

SmtpClient.Command Method (String, String)

Send a custom command to the server.

[Visual Basic]
Overloads Public Function Command( _
   ByVal command As String, _
   ByVal parameters As String _
) As Boolean
[C#]
public bool Command(
   string command,
   string parameters
);

Parameters

command
A string which specifies the command to send. Valid commands vary based on the Internet protocol and the type of server that the client is connected to. Consult the protocol standard and/or the technical reference documentation for the server to determine what commands may be issued by a client application.
parameters
An string which specifies one or more parameters to be sent along with the command. If more than one parameter is required, they must be separated by a single space character. Consult the protocol standard and/or technical reference documentation for the server to determine what parameters should be provided when issuing a specific command.

Return Value

This method returns a Boolean value. If the method succeeds, the return value is true. If the method fails, the return value is false. To get extended error information, check the value of the LastError property.

Remarks

The Command method sends a command to the remote host and processes the result code sent back in response to that command. This method can be used to send custom commands to a server to take advantage of features or capabilities that may not be supported internally by the class library.

To determine the specific status code returned by the server, check the value of the ResultCode property after the method returns.

See Also

SmtpClient Class | SocketTools Namespace | SmtpClient.Command Overload List