RetrieveMessages Method


Retrieves all messages or the specified range of messages from the e-mail account.

No messages are deleted by this method.

To retrieve single message, use RetrieveSingleMessage 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.RetrieveMessages([First], [Last])  
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).  
Return value As Messages Messages collection of Message objects where each object stores all message information. If error has 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.RetrieveMessages
  If Not Msgs Is Nothing Then
    For Each Msg In Msgs
      MsgBox "Attachments count: " & Msg.Attachments.Count
    Next
  End If
  Mailer.Disconnect
End If

See Also:

RetrieveSingleMessageHeaders Method
RetrieveSingleMessage Method
RetrieveHeaders Method
Message Object
Messages Collection


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