Search code examples
delphiimapindy

Retrieve error message when 'BAD error_here' is sent from the imap4 server


I have a TIdImap4 client and I sometimes receive this from an imap server :

C3 BAD Mailbox parameter is invalid.

I've managed to fix the request from my client, but the only way I could read this error message was in the indy function :

function TIdIMAP4.GetInternalResponse(const ATag: String; 
  AExpectedResponses: array of String;  
  ASingleLineMode: Boolean; ASingleLineMayBeSplit: Boolean {= False}): string;

, but when the result of function TIdIMAP4.StatusMailBox(const AMBName: String; AMB: TIdMailBox; const AStatusDataItems: array of TIdIMAP4StatusDataItem): Boolean; is False I don't know how to access the error message. I've tried the properties :

- imap4Client.LastCmdResult.Text.Text 
- imap4Client.LastCmdResult.FormattedReply.Text

but there is no error message in them.


Solution

  • Try looking in the TIdReplyIMAP4(imap4Client.LastCmdResult).Extra property.