MessagePreview Property


Contains the reference (if it is available) to the Message object which holds the partial message.

By default, this property is Nothing and partial message is not avialable. To get envelopes with this property set, call RetrieveEnvelopesEx method of IMAP4 object with AlsoGetMessagePreview parameter set to True.

The degree of completeness of the partial message depends on value of BodyPreviewSize parameter of RetrieveEnvelopesEx method of IMAP4 object. If BodyPreviewSize=0, only message headers are available. Bigger BodyPreviewSize, more bytes of the message body are retrieved.

MessagePreview holds the same message you can get standalone using RetrieveSingleMessageHeaders method of IMAP4 object. However, using MessagePreview property, you can get envelopes and message previews for multiple messages at once.


Value Type: MailBee.Message
Parameters: None 
Remarks: This property is read-only

Usage example:

' This sample displays preview of body text (taken from first
' 1000 bytes of the body) of the last message 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.RetrieveEnvelopesEx _
(Mailer.MessageCount, Mailer.MessageCount, False, False, True, 1000) If Not Envelopes Is Nothing Then For Each Envelope In Envelopes MsgBox Envelope.MessagePreview.BodyText Next End If End If Mailer.Disconnect End If

See Also:

BodyStructure Property

Message Object
Envelope Object

IMAP4.RetrieveEnvelopesEx Method
IMAP4.RetrieveSingleMessageHeaders Method


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