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

Retrieves SMTP envelope information for a message in the mailbox.

function RetrieveEnvelope(
    const AMsgNum: Integer; 
    AMsg: TIdMessage
): Boolean;
Parameters 
Description 
AMsgNum 
Message number to retrieve from the mailbox.
 
AMsg 
Message instance to store the return values. 

Boolean - True on success.

RetrieveEnvelope is a Boolean function used to retrieve the SMTP envelope information for the relative message number specified in AMsgNum, and to store the information in the message identified by AMsg. 

RetrieveEnvelope validates the relative message number in aMsg to ensure that it contains a positive non-zero value. An EIdNumberInvalid exception will be raised when the realtive message number is invalid. 

RetrieveEnvelope requires that ConnectionState contain the value csSelected, indicating a mailbox has been successfully selected and authenticated. RetrieveEnvelope can raise an EIdConnectionStateError exception if a mailbox has not been selected and/or authenticated for the current user. 

RetrieveEnvelope calls SendCmd using the IMAP4 FETCH command and arguments constructed from the value in AMsgNum and the IMAP4 fetch data flags required for the operation. RetrieveEnvelope reads the multi-line response from the IMAP4 server, and verifies that the initial response matches the command issued using SendCmd. When they are the same, RetrieveEnvelope extracts the SMTP headers from the response and parses the header values in the message specified in AMsg. 

Use RetrieveEnvelopeRaw to retrieve and store message envelope data into a specified TStrings argument. 

Use UIDRetrieve or UIDRetrieveEnvelopeRaw to retrieve and store message envelope data for a message identified by its unique identifier (UID).

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