RetrieveMailboxes Method


Retrieves Mailboxes collection which contains all mailboxes in the IMAP4 account.

RetrieveMailboxesEx method provides additional functionality.


objMailboxes = ObjectName.RetrieveMailboxes([SubscribedOnly])  
Parameters:  
SubscribedOnly As Boolean (optional) If True, only subscribed mailboxes are retrieved. Default is False  
Return value As MailBee.Mailboxes On success, Mailboxes collection is returned. On failure, return value is Nothing  

Usage example:

' This sample gets all mailboxes list and selects last mailbox in the collection.
' Then, messages count is displayed for this mailbox.
Dim Mailer, Mailboxes
'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
  Set Mailboxes = Mailer.RetrieveMailboxes
  If Not Mailboxes Is Nothing Then
    If Mailboxes.Count > 0 Then
      If Mailer.SelectMailbox(Mailboxes(Mailboxes.Count).Name) Then
        MsgBox Mailer.MessageCount & " messages in " & Mailboxes(Mailboxes.Count).Name
      End If
    End If
  End If
  Mailer.Disconnect
End If

See Also:

Mailbox Object

Mailboxes Collection

ExamineMailbox Method
SelectMailbox Method


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