Tag Archives: mailbox

How to obtain POP3 mailbox information

The simplest way to obtain information about a specified mailbox is using GetMailboxInfo method. You only need to pass the mailbox name to the method. It returns a Pop3MailboxInfo object containing information about the mailbox you have requested.

The following steps will help you to do that using ComponentPro Mail component:

C#

// Create a new instance of the Pop3Client class. 
Pop3Client client = new Pop3Client(); 
// Connect to the server. 
client.Connect("myserver"); 
// Or you can specify the POP3 port with 
// client.Connect("myserver", 110); 
// Login to the server. 
client.Authenticate("user", "password"); 
// Obtain mailbox information. 
Pop3MailboxInfo info = client.GetMailboxInfo(); 
// Print out some information. 
Console.WriteLine("Number of messages found: {0}", info.MessageCount); 
Console.WriteLine("Mailbox Size: {0}", info.Size); 
// Close the connection. 
client.Disconnect();

VB.NET

' Create a new instance of the Pop3Client class. 
Dim client As New Pop3Client() 
' Connect to the server. 
client.Connect("myserver") 
' Or you can specify the POP3 port with 
' client.Connect("myserver", 110); 
' Login to the server. 
client.Authenticate("user", "password") 
' Obtain mailbox information. 
Dim info As Pop3MailboxInfo = client.GetMailboxInfo() 
' Print out some information. 
Console.WriteLine("Number of messages found: {0}", info.MessageCount) 
Console.WriteLine("Mailbox Size: {0}", info.Size) 
' Close the connection. 
client.Disconnect()