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

Namespace: MailBee.ImapMail
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 11.2.0 build 590 for .NET 4.5
Syntax
public bool ExecuteCustomCommand(
	string command,
	string commandID
)

Parameters

command
Type: SystemString
User-defined command text (without line terminator).
commandID
Type: SystemString
The ID (tag in IMAP4 terms) which will be prepended to the command text, or an empty string to let MailBee autogenerate the ID value, or a null reference (Nothing in Visual Basic) to send command without ID.

Return Value

Type: Boolean
true if the command was executed successfully; otherwise, false.
Exceptions
ExceptionCondition
MailBeeExceptionAn error occurred and ThrowExceptions is true.
Remarks

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(String) methods.

To check if the server supports the particular extension/capability, the developer can use GetExtension(String) method passing the name of the capability.

Examples
This sample connects to the IMAP4 server, logs in the mail account, and sends IDLE and DONE commands (the server must support IDLE extension).
// 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();
See Also