RetrieveHeaders Method


Retrieves headers for the specified range or for all messages in the e-mail account. You can also specify partial downloading of messages' bodies (for message preview purposes).

No messages are deleted by this method.

To retrieve headers for a single message, use RetrieveSingleMessageHeaders method.

Note that in Gmail you may not receive via POP3 all messages which you see in the web interface. Go to Gmail POP settings to configure this.


objMessages = ObjectName.RetrieveHeaders([First], [Last], [BodyLinesCount])  
Parameters:  
First (optional) The first index in the range to download. Default is 1.  
Last (optional) The last index in the range to download. Default is -1 which denotes the last message in the inbox (POP3.MessageCount).  
BodyLinesCount As Long (optional) Number of body lines to download for each message. Default value is 0 (i.e. only header lines are downloaded). You can specify value greater than actual lines number in particular message - in this case RetrieveHeaders method will just return full message (as if RetrieveMessages method was executed for this message)  
Return value As Messages Messages collection of Message objects where each object stores all header information (and, optionally, downloaded body part). If error occurred, return value is Nothing.  

Usage example:

Dim Mailer, Msgs, 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
  Set Msgs = Mailer.RetrieveHeaders(,,10) ' Download headers plus first 10 lines of body for all emails in inbox
  If Not Msgs Is Nothing Then
    For Each Msg In Msgs
      MsgBox "Subject: " & Msg.Subject
    Next
  End If
  Mailer.Disconnect
End If

See Also:

RetrieveSingleMessageHeaders Method
RetrieveSingleMessage Method
RetrieveMessages Method
Message Object
Messages Collection


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