Pop3ExecuteCustomCommand Method |
Sends user-defined command to the server and receives the server response to this command.
Namespace: MailBee.Pop3MailAssembly: MailBee.NET (in MailBee.NET.dll) Version: 12.5.0 build 687 for .NET 4.5
Syntax public bool ExecuteCustomCommand(
string commandString,
bool multiLineResponse
)
Public Function ExecuteCustomCommand (
commandString As String,
multiLineResponse As Boolean
) As Boolean
Parameters
- commandString
- Type: SystemString
User-defined command text (including line terminator). - multiLineResponse
- Type: SystemBoolean
true if the given command returns multi-line response
on success; false if the given command always produces single-line response.
Return Value
Type:
Booleantrue if the command was executed successfully; otherwise,
false.
Exceptions Remarks The developer can use
GetServerResponse method to obtain the response
data returned by the server.
Examples This sample connects to the POP3 server, issues HELP command, and displays
the server response to this command. If HELP command is not supported by the server,
MailBee will throw
MailBeePop3NegativeResponseException. It's caught in
the sample code, and the proper error message is displayed.
using MailBee;
using MailBee.Pop3Mail;
Pop3 pop = new Pop3();
pop.Connect("mail.domain.com");
try
{
pop.ExecuteCustomCommand("HELP\r\n", false);
Console.WriteLine(pop.GetServerResponse());
}
catch (MailBeePop3NegativeResponseException e)
{
Console.WriteLine(e.Message);
Console.WriteLine("Server response is: " + pop.GetServerResponse());
}
pop.Disconnect();
Imports MailBee
Imports MailBee.Pop3Mail
Dim pop As New Pop3
pop.Connect("mail.domain.com")
Try
pop.ExecuteCustomCommand("HELP" & vbCrLf, False)
Catch e As MailBeePop3NegativeResponseException
Console.WriteLine(e.Message)
Console.WriteLine("Server response is: " & pop.GetServerResponse())
End Try
pop.Disconnect()
See Also