Internet Direct (Indy) Version 9.0.2 Beta
TIdIMAP4.RetrievePeek
Retrieves a specified message number from a mailbox preserving its Seen flag.

function RetrievePeek(const AMsgNum: Integer; AMsg: TIdMessage): Boolean;
Parameters
const AMsgNum: Integer
Message number to be retrieved from the mailbox.

AMsg: TIdMessage
Message instance to store the retrieved message.

Returns
Boolean - True on success.

Description
RetrievePeek is a Boolean function that retrieves the message specified in AMsgNum and stores the result in the mesage instance specified by AMsg. Unlike Retrieve, RetrievePeek preserves the state of the Seen flag for the message in the mailbox.

RetrievePeek requires that ConnectionState contain the value csSelected, or an EIdConnectionStateError exception wil be raised. RetrievePeek sends the IMAP4 FETCH command to retrieve data for the specified message number. RetrievePeek insures that the server response contains untagged resposnes for the desired message prior to calling ReceiveHeader and ReceiveBody to populate the message instance.

RetrievePeek sets the return value to True when ResultNo contains the value wsOk.