Internet Direct (Indy)
Home
PreviousUpNext
TIdIMAP4.SendCmd Method (string, array of String)

Sends an IMAP4 command to the server and checks for valid response codes.

Pascal
function SendCmd(
    const AOut: string; 
    AExpectedResponses: array of String
): string; overload;
Parameters 
Description 
AOut 
Command to be executed on the IMAP4 server.
 
AResponse 
Anticipated server reponse(s). -1 when omitted. 

String - Response received from the IMAP4 server.

SendCmd is an overloaded String function in TIdIMAP4 that allows the client to send the IMAP4 command specified in 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 ensures that any unhandled data remaining in the buffer for the client connection is read prior to writing a new command for the remote IMAP4 server. 

SendCmd calls WriteLn to send the value AOut to the IMAP4 server, and calls GetResponse to determine the server response. The return value for the method contains the initial IMAP4 server response received for the command. 

SendCmd will handle an EIdSocketError exception raised when sending the command by setting the ConnectionState property to the value csUnexpectedlyDisconnected. The exception is re-raised for subsequent error handling.

Internet Direct (Indy) version 10.1.5
Copyright © 1993-2006, Chad Z. Hower (aka Kudzu) and the Indy Pit Crew. All rights reserved.
Website http://www.indyproject.org.
Post feedback to the Indy Documentation newsgroup.