This tutorial illustrates how to obtain Mailbox information with a few lines of code in UltimateIMAP Component. The simplest way to obtain information about a specified mailbox is using the GetMailboxInfo method. You only need to pass the mailbox name to the method. It returns a Mailbox object containing information about the mailbox you have requested as shown in the following steps:
- Create a new instance of the ImapClient class and call the Connect methods. The code looks similar to the following:
- C#
// Create a new instance of the ImapClient class.
ImapClient client = new ImapClient();
// Connect to the server.
client.Connect("myserver");
// Or you can specify the IMAP port with
// client.Connect("myserver", 143);
// Login to the server.
client.Authenticate("user", "password");
// Get information about the INBOX mailbox.
Mailbox m = client.GetMailboxInfo("INBOX");
Console.WriteLine("The number of recent messages: " + m.RecentMessages);
Console.WriteLine("The number of new unseen messages messages: " + m.NewUnseenMessages);
// Close the connection.
client.Disconnect();
VB.NET
' Create a new instance of the ImapClient class.
Dim client As New ImapClient()
' Connect to the server.
client.Connect("myserver")
' Or you can specify the IMAP port with
' client.Connect("myserver", 143);
' Login to the server.
client.Authenticate("user", "password")
' Get information about the INBOX mailbox.
Dim m As Mailbox = client.GetMailboxInfo("INBOX")
Console.WriteLine("The number of recent messages: " & m.RecentMessages)
Console.WriteLine("The number of new unseen messages messages: " & m.NewUnseenMessages)
' Close the connection.
client.Disconnect()
Posted via web from ComponentSoft.net Ultimate IMAP Component's Blog
Recent Comments