Topic Path: Symbol Reference > Classes > TIdIMAP4 Class > TIdIMAP4 Methods > GetResponse Method
ContentsIndexHome
PreviousUpNext
TIdIMAP4.GetResponse Method

Retrieves and checks a multiple line IMAP4 server response.

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.

Copyright 1993-2006, Chad Z. Hower (aka Kudzu) and the Indy Pit Crew. All rights reserved.
Post feedback to the Indy Docs Newsgroup.