Topic Path: Symbol Reference > Classes > TIdIMAP4 Class > TIdIMAP4 Methods > RetrieveMailBoxSize Method
TIdIMAP4.RetrieveMailBoxSize Method

Indicates the size of all messages in the currently selected mailbox.

function RetrieveMailBoxSize: Integer;

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

RetrieveMailBoxSize is an Integer function that calculates the size of all messages in the currently selected mailbox. The calculated size for the mailbox includes all message parts (including attachments) currently stored on the remote IMAP4 server. 

RetrieveMailBoxSize requires that ConnectionState contain the value csSelected, or an EIdConnectionStateError exception will be raised. Use SelectMailBox or ExamineMailBox to select the current mailbox for the IMAP4 account prior to calling RetrieveMailBoxSize. 

RetrieveMailBoxSize calls SendCMd using the IMAP4 FETCH command to get the message size for each of the messages in the IMAP mailbox, and accumulates the total size as the return value for the method. The return value for RetrieveMailBoxSize is -1 if a protocol response error occurs in the method. 

Use RetreiveMsgSize or UIDRetreiveMsgSize to determine the size of a specific message stored in the currently selected mailbox for the IMAP4 account.

ConnectionState EIdConnectionStateError SendCmd RetreiveMsgSize UIDRetreiveMsgSize IMAP_OK

Copyright 1993-2006, Chad Z. Hower (aka Kudzu) and the Indy Pit Crew. All rights reserved.
Post feedback to the Indy Docs Newsgroup.