RetrieveMessagesSize Method


Retrieves combined size (in bytes) of one or more messages in the currently selected IMAP4 mailbox.

To get total size of all messages in the currently selected IMAP4 mailbox, call RetrieveTotalSize method.

Message size is also available as the Size property of Envelope object. See RetrieveEnvelopes method description on how to get message envelopes.

To retrieve the size for single message only, specify the same value for the First and the Last parameters.

To get the size of an arbitrary set of messages, specify MessageSet property and pass -1 as First value (Last value is not important when First is -1). AsUID parameter is still honored when IDs are taken from MessageSet property (depending on AsUID value, they will be treated as UIDs or ordinal message numbers).


objEnvelopes = ObjectName.RetrieveMessagesSize(First, Last, AsUID)  
Parameters:  
First As Long Message number or UID of the first message in the range, or -1 to use MessageSet as input.  
Last As Long Message number or UID of the last message in the range, or -1 to denote the last message in the mailbox.  
AsUID As Boolean If True, First and Last parameters must be specified as UIDs (unique-IDs). Otherwise, First and Last must be message numbers.  
Return value As Long On success, combined size of all messages in the range. On failure, return value is 0.  

Usage example:

' This sample displays the combined size of the first 10 messages in Inbox
Dim Mailer
'Using visual basic to create object
Set Mailer = CreateObject("MailBee.IMAP4")
'Using ASP to create object
'Set Mailer = Server.CreateObject("MailBee.IMAP4")
'In ASP use Response.Write instead of MsgBox
Mailer.EnableLogging = True
Mailer.LogFilePath = "C:\Temp\imap4_log.txt"
Mailer.ClearLog
Mailer.LicenseKey = "put your license key here"
If Mailer.Connect("mailserver.com", 143, "MyName", "MyPassword") Then
  If Mailer.SelectMailbox("Inbox") Then
    MsgBox Mailer.RetrieveMessagesSize(1, 10, False) & " bytes"
  End If
  Mailer.Disconnect
End If

See Also:

Envelope Object

Envelope.Size Property

RetrieveEnvelopes Method
RetrieveSingleMessageHeaders Method
RetrieveTotalSize Method


Copyright © 2002-2024, AfterLogic Corporation. All rights reserved.