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

Retrieves RFC-822 envelope data for messages in a mailbox.

function RetrieveAllEnvelopes(
    AMsgList: TIdMessageCollection
): Boolean;
Parameters 
Description 
AMsgList 
Collection of message instances for storing message envelope data. 

Boolean - True on success, False on exception or protocol error.

RetrieveAllEnvelopes is a Boolean function used to retrieve IMAP4 envelope data for all messages in the currently selected IMAP4 mailbox by their message number. 

IMAP4 envelope information consists of data items that describe the envelope structure of a message and is computed by parsing RFC-822 message headers from individual messages in the IMAP4 mailbox. Fields in the envelope structure are in the following order: date, subject, from, sender, reply-to, to, cc, bcc, in-reply-to, and message-id. 

Any member in an envelope structure that is not applicable is presented as an empty value. Please note that the IMAP4 server sends a default value for the reply-to and sender fields using the from field; a client is not expected to know how to do this. 

RetrieveAllEnvelopes requires that the ConnectionState property for the IMAP4 client contain the value csSelected, or an EIdConnectionStateError exception will be raised and the return value will be set to False. 

RetrieveAllEnvelopes implements the IMAP4 FETCH command using arguments that will result in all envelope data items for the messages in the selected mailbox. The multi-line response from the IMAP4 server is captured and parsed into TIdMessages instances in the AMsgList collection. 

Please note that existing items in AMsgList are assumed to be in relative message number order, and will overwrite message headers for the TIdMessage instances based on that assumption. When AMsgList is unassigned, or does not contain enough items for the envelopes in the mailbox, a new TIdMessage instance is created and added to the AMsgList collection. 

The return value for RetrieveAllEnvelopes will be True when the protocol response code from the IMAP4 server is IMAP_OK, and the multi-line response is successfully parsed into the AMsgList collection. 

Use UIDLRetrieveAllEnvelopes to retrieve envelope data for messages using their unique identifier(s).

TIdMessage TIdMessageCollection UIDLRetrieveAllEnvelopes

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