RetrieveSingleMessage Method
Retrieves a message from currently selected
IMAP4 mailbox.
The message is received completely: including headers, body and any attachments.
If the method succeeds, return value is a Message
object which fully represents the message.
To retrieve message headers only, use RetrieveSingleMessageHeaders
method. To retrieve headers for multiple messages, use RetrieveEnvelopes
or RetrieveEnvelopesEx
methods (these methods also let you get more information about messages, such as flags).
objMessage = ObjectName.RetrieveSingleMessage(Index, AsUID) |
Parameters: | ||
Index As Long | Message number or UID of the message to retrieve | |
AsUID As Boolean | If True, Index parameter must be specified as UIDs (unique-IDs). Otherwise, Index must be a message number | |
SetSeenFlag As Boolean | (optional) If True, \Seen flag will be set for this message upon downloading; otherwise, it won't. The default is True | |
Return value As MailBee.Message | On success, the method returns Message object which represents the message. On failure, return value is Nothing |
Usage example:
' This sample retrieves last message in Inbox and displays its body Dim Mailer, Message '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 Message = Mailer.RetrieveSingleMessage(Mailer.MessageCount, False) If Not Message Is Nothing Then MsgBox Message.BodyText End If End If Mailer.Disconnect End If
See Also:
Message Object
RetrieveEnvelopes Method
RetrieveEnvelopesEx Method
RetrieveSingleMessageHeaders
Method
Copyright © 2002-2024, AfterLogic Corporation. All rights reserved.