RetrieveEnvelopes Method
Retrieves one or more message envelopes from
currently selected IMAP4 mailbox.
Each envelope in returned collection is an Envelope
object which represents brief information of the message: size, subject, "From",
"To", "Date", etc.
To retrieve single message envelope only, specify the same value for the First
and the Last parameters.
To get 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).
To get more detailed synopsis on each message (such as message attachments list
or custom headers), use RetrieveEnvelopesEx
method.
objEnvelopes = ObjectName.RetrieveEnvelopes(First, Last, AsUID) |
Parameters: | ||
First As Long | Message number or UID of the first message envelope to retrieve, or -1 to use MessageSet as input. | |
Last As Long | Message number or UID of the last message envelope to retrieve, 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 MailBee.Envelopes | On success, Envelopes collection is returned. On failure, return value is Nothing. |
Usage example:
' This sample displays Subject for the first 10 messages in Inbox Dim Mailer, Envelopes, Envelope '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 Set Envelopes = Mailer.RetrieveEnvelopes(1, 10, False) If Not Envelopes Is Nothing Then For Each Envelope In Envelopes MsgBox Envelope.Subject Next End If End If Mailer.Disconnect End If
See Also:
Envelope Object
Envelopes Collection
RetrieveEnvelopesEx Method
RetrieveSingleMessageHeaders
Method
Copyright © 2002-2024, AfterLogic Corporation. All rights reserved.