Internet Direct (Indy) Version 9.0.1 Beta
TIdIMAP4.SendCmd
Sends a tagged IMAP4 command to the server and checks for valid response codes.

function SendCmd(const ATag: string; const AOut: string; const AResponse: SmallInt): SmallInt; overload;
function SendCmd(const ATag: string; const AOut: string; const AResponse: array of SmallInt): SmallInt; overload;
Parameters
const ATag: string
Tag to identify the server response to this command.

const AOut: string
Command to be executed on the IMAP4 server.

const AResponse: SmallInt = -1
Anticipated server reponse(s). -1 when omitted.

Returns
SmallInt - Response code received from the IMAP4 server.

Description
SendCmd is an overloaded SmallInt function in TIdIMAP4 that allows the client to send the tagged command specified in ATag and AOut to the IMAP4 server, and anticipates a response or responses as specified in AResponse.

AResponse can be an array of SmallInt values that indicate the valie responses for the command, or a single SmallInt value.

SendCmd calls WriteLn to send the values in Atag and AOut to the IMAOP4 server, and calls GetResponse to determine the server response.