Internet Direct (Indy) Version 9.0.2 Beta
TIdIMAP4.Retrieve
Retrieves a message from a mailbox and marks it as read on the server.

function Retrieve(const AMsgNum: Integer; AMsg: TIdMessage): Boolean;
Parameters
const AMsgNum: Integer
Message number to retreive from the mailbox.

AMsg: TIdMessage
Stores the retrieved message headers, body, and attachments.

Returns
Boolean - True on success.

Description
Retrieve is a Boolean function that retrieves a message from a mailbox and marks it as read on the server. Retrieve requires that ConnectionState contain the value csSelected, or an EIdConnectionStateError exception will be raised.

Retrieve send the IMAP4 FETCH command for the specified message number. On successful retrieval of the RFC 822 envelope data, Retrieve calls ReceiveHeader and ReceiveBody to load the message contents into the TIdMessage instance specified by AMsg.

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