GetMailboxStatus Method


Retrieves various stats for the specified mailbox without selecting it.

This method can be used to obtain the folder status information such as total count of messages, recent messages count, unseen messages count, etc without selecting the mailbox.


objStatus = ObjectName.RetrieveSingleMessage(Index, AsUID)  
Parameters:  
MailboxName As String Mailbox name  
Return value As MailBee.MailboxStatus On success, the method returns MailboxStatus object which represents the mailbox stats. On failure, return value is Nothing  

Usage example:

' This sample retrieves and displays all the stats of Inbox
Dim Mailer, Stats
'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("mail.server.com", 143, "MyName", "MyPassword") Then
  Set Stats = Mailer.GetMailboxStatus("Inbox")
  If Not Stats Is Nothing Then
    MsgBox "MessageCount=" & Stats.MessageCount & " RecentCount=" & Stats.RecentCount & " UnseenCount=" & Stats.UnseenCount
    MsgBox "UIDValidity=" & Stats.UIDValidity & " UIDNext=" & Stats.UIDNext
  End If
  Mailer.Disconnect
End If

See Also:

Message Object


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