Back to feature list...
Advanced features
Obtaining info about the mailbox
To retrieve message count or see of all messages currently in the mailbox, use GetMessageCount
or GetMailboxSize
methods:
// create POP3 client instance, connect, log in // ... // get info about mailbox int count = client.GetMessageCount(); long size = client.GetMailboxSize(); // print some info Console.WriteLine("Total mails count: {0}", count); Console.WriteLine("Total mailbox size: {0}B", size);
' create POP3 client instance, connect, log in ' ... ' get info about mailbox Dim count As Integer = client.GetMessageCount() Dim size As Long = client.GetMailboxSize() ' print some info Console.WriteLine("Total mails count: {0}", count) Console.WriteLine("Total mailbox size: {0}B", size)
Fine-tuning POP3 behavior
Pop3
objects makes it possible to specify various low-level settings
and workarounds.
Custom commands
The Pop3
object can execute custom commands, which makes it
possible to utilize functionality not yet covered by Rebex API.
To send a custom command use the Pop3.SendCommand
method.
To read the response of this command use the Pop3.ReadResponse
method.
POP3 commands either provide a single-line or multi-line response.
You need to specify the appropriate mode in the SendCommand
method.
The following code sends a single-line STAT and reads its response:
// create POP3 client instance, connect, log in // ... // send custom command STAT client.SendCommand("STAT", false); // process server response string response = client.ReadResponse(); Console.WriteLine(response);
' create POP3 client instance, connect, log in ' ... ' send custom command STAT client.SendCommand("STAT", False) ' process server response Dim response = client.ReadResponse() Console.WriteLine(response)
The following code sends a multi-line HELP and reads its response:
// send custom command HELP client.SendCommand("HELP", true); // process server response string response = client.ReadResponse(); while (response != null) { Console.WriteLine(response); response = client.ReadResponse(); }
' send custom command HELP client.SendCommand("HELP", True) ' process server response Dim response = client.ReadResponse() While response IsNot Nothing Console.WriteLine(response) response = client.ReadResponse() End While
Back to feature list...