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

Retrieves RFC headers for a specified message and message part.

function RetrievePartHeader(
    const AMsgNum: Integer; 
    const APartNum: string; 
    AHeaders: TIdHeaderList
): Boolean;
Relative message number for retrieved headers.
Relative message part number for retrieved headers.
Header values retrieved from the message and message part. 

Boolean - True on Success.

RetrievePartHeader is a Boolean function used to retrieve RFC-compliant headers for a specific message part using the relative message number for the current mailbox. 

AMsgNum specifies the relative message number for the message as stored in the current mailbox on the remote IMAP4 server. 

APartNum indicates the relative message part number to be used for retrieval of RFC-compliant message headers. APartNum is the ordinal position of the message part as indicated by RetrieveStructure

AHeaders is used to store the RFC-compliant message headers retrieved for the specified message and message part. 

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

RetrievePartHeader requires that ConnectionState contain the value csSelected, or an EIdConnectionStateError exception will be raised. Use SelectMailBox or ExamineMailBox to select a mailbox prior to calling RetrievePartHeader. 

RetrievePartHeader sends the IMAP4 FETCH command with the relative message number and data element requests needed to retrieve the message headers for a message part. 

The return value for the RetrievePartHeader method indicates if message headers were successfully retrieved using the specified message number and message part number. The return value will be False if a protocol error response (a value other than IMAP_OK) is received during processing in the method. 

Text returned in the IMAP4 server response is parsed to determine the size of the message headers for the specified message part. Instances of TIdTCPStream and TIdStreamVCL are created for internal use during retrieval and storage of the message headers in the server response. 

Use OnWorkForPart to respond to work events occurring during retrieval of the message part headers. 

Use UIDRetrievePartHeader to retrieve message headers for a specified message part using the unique identifier (UID) for the message. 

Use RetrieveStructure to determine all of the message parts available in a message stored on the remote IMAP4 server. 

Use RetrievePart or UIDRetrievePart to retrieve the headers and the content for a specified message part. 

Use RetrievePartPeek or RetrievePartToFilePeek to retrieve a message part without affecting the message flags for the message.

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