Topic Path: Symbol Reference > Classes > TIdIMAP4 Class > TIdIMAP4 Methods > RetrieveMsgSize Method
ContentsIndexHome
PreviousUpNext
TIdIMAP4.RetrieveMsgSize Method

Indicates the size of a specified message in the currently selected mailbox.

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

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

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

RetrieveMsgSize validates the message number in AMsgNum to ensure that it contains a positive non-zero value, and raises an EIdNumberInvalid exception if the requirement is not met. 

RetrieveMsgSize requires that ConnectionState contain the value csSelected, or an EIdConnectionStateError exception will be raised. Use SelectMailBox or ExamineMailBox to select a mailbox prior to calling RetrieveMsgSize. 

RetrieveMsgSize calls SendCMd using the IMAP4 FETCH command to get the message size for the specified relative message number in the IMAP mailbox. The server response is examined for the message size when the server response contains the value IMAP_OK, and sets the return value for the method. The return value for RetrieveMsgSize is -1 if a protocol error response occurs in the method. 

Use UIDRetrieveMsgSize to retrieve the size of a message using the unique identifier (UID) for the message. 

Use RetrieveMailBoxSize to retrieve the space required for all messages in the currently selected mailbox for the IMAP4 account.

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