Internet Direct (Indy)
Home
PreviousUpNext
TIdIMAP4.UIDRetrieve Method

Retrieves a message from a mailbox and marks it as read on the server.

Pascal
function UIDRetrieve(
    const AMsgUID: String; 
    AMsg: TIdMessage
): Boolean;
Parameters 
Description 
AMsgUID 
Message unique identifier to retreive from the mailbox.
 
AMsg 
Stores the retrieved message headers, body, and attachments. 

Boolean - True on success.

UIDRetrieve is a Boolean function that retrieves the entire contents for a given message unique identifier from a mailbox and marks it as read on the remote IMAP4 server. UIDRetrieve requires that ConnectionState contain the value csSelected, or an EIdConnectionStateError exception will be raised. 

UIDRetrieve calls a protected method that sends the IMAP4 FETCH command for the message UID specified in AMsgUID. UIDRetrieve performs validation for the message UID to ensure that it contains a valid value. An EIdNumberInvalid exception can be raised if the unique identifier in aMsgUID is invalid. 

On successful retrieval of the RFC 822 envelope data, UIDRetrieve calls ReceiveHeader and ReceiveBody to load the message contents into the TIdMessage instance specified by AMsg. All headers, message parts, and the body of the message instance are cleared prior to storing values retrieved from the remote IMAP4 server. The value of the UID and Flags properties for the message in AMsg are updated based on the values found in the IMAP4 server response. 

UIDRetrieve creates an internal TIdTCPStream instance to read message parts in the serve response, and assigns event handlers for the operation using procedure stored in OnWorkBeginForPart, OnWorkForPart, and OnWorkEndForPart

UIDRetrieve sets the return value to True when the IMAP4 server response contains the value IMAP_OK

Use SelectMailBox or ExamineMailBox to select a mailbox and retrieve messages or headers in Mailbox prior to calling the UIDRetrieve method. 

Use Retrieve to retrieve a message using the relative message number for a message in the selected mailbox.

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.