Internet Direct (Indy) Version 9.0.2 Beta
TIdIMAP4.RetrieveMsgSize
Indicates the size of a specified message in the currently selected mailbox.

function RetrieveMsgSize(const AMsgNum: Integer): Integer;
Parameters
const AMsgNum: Integer
Message number to access in the mailbox.

Returns
Integer - Bytes required to store the message in the mailbox or -1 when an error occurs.

Description
RetrieveMsgSize is an Integer function that calculates the size of the message specified by AMsgNum in the currently selected mailbox.

RetrieveMsgSize requires that ConnectionState contain the value csSelected, or an EIdConnectionStateError exception will be raised. The return value for RetrieveMsgSize is -1 if an error occurs in the method. RetrieveMsgSize calls SendCMd using the IMAP4 FETCH command to get the message size for the specified message number in the IMAP mailbox, and sets the return value for the method.