Internet Direct (Indy) Version 9.0.1 Beta
TIdIMAP4.RetrieveMailBoxSize
Indicates the size of all messages in the currently selected mailbox.

function RetrieveMailBoxSize: Integer;
Returns
Integer - Bytes required to store all messages in the mailbox or -1 when an error occurs.

Description
RetrieveMailBoxSize is an Integer function that calculates the size of all messages in the currently selected mailbox.

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