SmtpExecuteCustomCommand Method
Sends user-defined command to the server and receives the server response to this command.

Namespace: MailBee.SmtpMail
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 11.2.0 build 590 for .NET 4.5
Syntax
public bool ExecuteCustomCommand(
	string commandString
)

Parameters

commandString
Type: SystemString
User-defined command text (including line terminator).

Return Value

Type: Boolean
true if the command was executed successfully; otherwise, false.
Exceptions
ExceptionCondition
MailBeeExceptionAn error occurred and ThrowExceptions is true.
Remarks
The developer can use GetServerResponse method to obtain the response data returned by the server.
Examples
This sample connects to the SMTP server, issues HELP command, and displays the server response to this command. If HELP command is not supported by the server, MailBee will throw MailBeeSmtpNegativeResponseException. It's caught in the sample code, and the proper error message is displayed.
// To use the code below, import these namespaces at the top of your code.
using System;
using MailBee;
using MailBee.SmtpMail;

// The actual code (put it into a method of your class)

Smtp mailer = new Smtp();
mailer.SmtpServers.Add("smtp.host.com");
mailer.Connect();
try
{
    // Send HELP command.
    mailer.ExecuteCustomCommand("HELP\r\n");
    Console.WriteLine(mailer.GetServerResponse());
}
catch (MailBeeSmtpNegativeResponseException e)
{
    // The given SMTP server does not support HELP command.
    Console.WriteLine(e.Message);
    Console.WriteLine("Server response is: " + mailer.GetServerResponse());
}
mailer.Disconnect();
See Also