Sends user-defined command to the server and receives the server response to this command.
true if the command was executed successfully; otherwise, false.
The developer can use GetServerResponse method to obtain the response data returned by the server.
| Exception Type | Condition |
|---|---|
| MailBeeException | An error occurred and ThrowExceptions is true. |
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.
[C#] // To use the code below, import MailBee namespaces at the top of your code. using MailBee; using MailBee.Pop3Mail; // The actual code (put it into a method of your class). Pop3 pop = new Pop3(); pop.Connect("mail.domain.com"); try { // Send HELP command (it produces a single-line response). pop.ExecuteCustomCommand("HELP\r\n", false); Console.WriteLine(pop.GetServerResponse()); } catch (MailBeePop3NegativeResponseException e) { // The given POP3 server does not support HELP command. Console.WriteLine(e.Message); Console.WriteLine("Server response is: " + pop.GetServerResponse()); } pop.Disconnect();
[Visual Basic] ' To use the code below, import MailBee namespaces at the top of your code. Imports MailBee Imports MailBee.Pop3Mail ' The actual code (put it into a method of your class). Dim pop As New Pop3 pop.Connect("mail.domain.com") Try ' Send HELP command (it produces a single-line response). pop.ExecuteCustomCommand("HELP" & vbCrLf, False) Catch e As MailBeePop3NegativeResponseException ' The given POP3 server does not support HELP command. Console.WriteLine(e.Message) Console.WriteLine("Server response is: " & pop.GetServerResponse()) End Try pop.Disconnect()
Pop3 Class | MailBee.Pop3Mail Namespace