Sends user-defined command to the server and receives the server response to this command.
true if the command was executed successfully; otherwise, false.
To use this method, the developer should have some knowledge of the IMAP4 protocol.
If commandID is non-empty string and not a null reference, MailBee will send the following request to the server (in C# terms): commandID + " " + command + "\r\n".
If commandID is "" (Empty), the entire request would be "MBNxxxxxxxx" + " " + command + "\r\n" where "xxxxxxxx" is an ordinal number of the issued command since the moment of establishing connection with the server.
If commandID is a null reference, the entire request would be command + "\r\n" (untagged request, also called "command continuation request").
To analyze results of user-defined commands, the developer can use GetServerResponse and GetServerResponses methods.
To check if the server supports the particular extension/capability, the developer can use GetExtension method passing the name of the capability.
| Exception Type | Condition |
|---|---|
| MailBeeException | An error occurred and ThrowExceptions is true. |
This sample connects to the IMAP4 server, logs in the mail account, and sends IDLE and DONE commands (the server must support IDLE extension).
[C#] // To use the code below, import MailBee namespaces at the top of your code using MailBee; using MailBee.ImapMail; // The actual code (put it into a method of your class) Imap imp = new Imap(); imp.Connect("imap.company.com"); imp.Login("jdoe", "secret"); imp.ExecuteCustomCommand("IDLE", string.Empty); imp.ExecuteCustomCommand("DONE", null); imp.Disconnect();
[Visual Basic] ' To use the code below, import MailBee namespaces at the top of your code Imports MailBee Imports MailBee.ImapMail ' The actual code (put it into a method of your class) Dim imp As New Imap imp.Connect("imap.company.com") imp.Login("jdoe", "secret") imp.ExecuteCustomCommand("IDLE", String.Empty) imp.ExecuteCustomCommand("DONE", Nothing) imp.Disconnect()
Imap Class | MailBee.ImapMail Namespace