Internet Direct (Indy)
Home
PreviousUpNext
TIdIMAP4.GetResponse Method

Retrieves and checks a multiple line IMAP4 server response.

Pascal
function GetResponse: string; overload; reintroduce;

String - The initial word from the server response.

GetResponse is a reintroduced string function in TIdIMAP4 that implements retrieval and processing of IMAP4 server responses. GetResponse is used to read and accumulate response lines from the remote IMAP4 server until a line that has a valid response that terminates the response. 

GetResponse handles server response that include the following: 

  • Simple tagged responses
 

 

  C41 OK Completed

 

  • Untagged responses followed by a tagged response:
 

  * LIST (UnMarked) "/" INBOX
  * LIST (UnMarked) "/" Junk
  * LIST (UnMarked) "/" Junk/Subbox1
  C42 OK Completed

 

  • Untagged success or failure reponses:
 

  * OK CommuniGate Pro IMAP Server 3.5.7 ready

 

  • Untagged message literals:
 

  + Send the additional command text

 

  • Completion responses:
 

  OK - search completed
  NO - search error: can't search that [CHARSET] or criteria
  BAD - command unknown or arguments invalid

 

Because you may get data first, which you need to skip, you need to accept all the above possibilities. 

We MUST stop when we find a valid response code, like OK

GetResponse sets the formatted reply in LastCmdResult using the initial tagged or completion response accumulated from the server.

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.