RetrieveSingleMessageHeaders Method


Retrieves headers for a particular message from the e-mail account. You can also specify partial downloading of message body (for message preview purposes).

No messages are deleted by this method.

To retrieve headers for all messages, use RetrieveHeaders method.


objMessage = ObjectName.RetrieveSingleMessageHeaders(Index, [BodyLinesCount])  
Parameters:  
Index As Long Index of the message to retrieve headers for. Allowed range is: 1 <= Index <= POP3.MessageCount
 
BodyLinesCount As Long (optional) Number of body lines to download for the message. Default value is 0 (i.e. only header lines are downloaded). You can specify value greater than actual lines number in the message - in this case RetrieveSingleMessageHeaders method will just return full message (as if RetrieveSingleMessage method was executed for this message)  
Return value As Message Message object filled with all headers information (and, optionally, downloaded body part). If error has occurred, return value is Nothing.  

Usage example:

Dim Mailer, Msg
'Using visual basic to create object
Set Mailer = CreateObject("MailBee.POP3")
'Using ASP to create object
'Set Mailer = Server.CreateObject("MailBee.POP3")
'In ASP use Response.Write instead of MsgBox
Mailer.LicenseKey = "put your license key here"
Mailer.Connect "mailserver.com", 110, "MyName", "MyPassword"
If Mailer.Connected Then
  If Mailer.MessageCount > 0 Then
    Set Msg = Mailer.RetrieveSingleMessageHeaders(1, 10) ' Also download first 10 lines of body
    If Not Msg Is Nothing Then
      MsgBox "Body preview: " & Msg.BodyText
    End If
  End If
  Mailer.Disconnect
End If

See Also:

RetrieveSingleMessage Method
RetrieveHeaders Method
RetrieveMessages Method
Message Object


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