Internet Direct (Indy)
Home
PreviousUpNext
TIdIMAP4.RetrieveHeader Method

Retrieves headers for a specified message number and populates the message instance.

Pascal
function RetrieveHeader(
    const AMsgNum: Integer; 
    AMsg: TIdMessage
): Boolean;
Parameters 
Description 
AMsgNum 
Message number to be retrieved from the mailbox.
 
AMsg 
Message instance used to store retrieved header values. 

Boolean - True on success.

RetrieveHeader is a Boolean function used to retrieve headers for the message number specified in AMsgNum, and populates the message instance specified in AMsg with the header values. 

RetrieveHeader validates the relative message number in AMsgNum to ensure that it contains a positive non-zero value, and raises and EIdNumberInvalid exception if the condition is not met. 

RetrieveHeader requires that ConnectionState contain the value csSelected, or an EIdConnectionStateError exception will be raised. Use SelectMailBox or ExamineMailBox to select the current mailbox for the IMAP4 account prior to calling RetrieveHeader. 

RetrieveHeader sends the IMAP4 FETCH command for the specified message number to access the stored header values. RetrieveHeader ensures that the untagged server response contains an RFC 822 header before populating the header values in the specified message instance. Please note that any existing header values in AMsg are cleared prior to parsing and storing headers from the IMAP4 server response. 

RetrieveHeader sets the return value to True when the protocol response contains the value IMAP_OK

RetrieveHeader is used in the implementation of the RetrieveAllHeaders method, which is in turn called by SelectMailBox when RetrieveOnSelect contains the value rsHeaders. 

Use UIDRetrieveHeader to retrieve message headers by a unique identifier (UID).

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.