Topic Path: Symbol Reference > Classes > TIdIMAP4 Class > TIdIMAP4 Methods > UIDRetrieveHeader Method
TIdIMAP4.UIDRetrieveHeader Method

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

function UIDRetrieveHeader(
    const AMsgUID: String; 
    AMsg: TIdMessage
): Boolean;
Message unique identifier to be retrieved from the mailbox.
Message instance used to store retrieved header values. 

Boolean - True on success.

UIDRetrieveHeader is a Boolean function used to retrieve headers for the message unique identifier specified in AMsgUID, and populates the message instance specified in AMsg with the header values. 

UIDRetrieveHeader validates the UID in AMsgUID to ensure that it contains a valid value, and raises and EIdNumberInvalid exception if the condition is not met. 

UIDRetrieveHeader 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 UIDRetrieveHeader. 

UIDRetrieveHeader sends the IMAP4 FETCH command for the specified message number to access the stored header values. UIDRetrieveHeader 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. 

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

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

Use RetrieveHeader to retrieve message headers by a relative message number.

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