Pop 3Client(IProtocol Logger) Constructor
Initializes a new instance of the Pop3Client class.
Definition
Namespace: MailKit.Net.Pop3
Assembly: MailKit (in MailKit.dll) Version: 5.0.0
Assembly: MailKit (in MailKit.dll) Version: 5.0.0
C#
public Pop3Client(
IProtocolLogger protocolLogger
)Parameters
- protocolLogger IProtocolLogger
- The protocol logger.
Remarks
Before you can retrieve messages with the Pop3Client, you must first call
one of the Connect methods
and authenticate using one of the
Authenticate methods.
Example
C#
public static void DownloadMessages ()
{
using (var client = new Pop3Client (new ProtocolLogger ("pop3.log"))) {
client.Connect ("pop.gmail.com", 995, SecureSocketOptions.SslOnConnect);
client.Authenticate ("username", "password");
for (int i = 0; i < client.Count; i++) {
var message = client.GetMessage (i);
// write the message to a file
message.WriteTo (string.Format ("{0}.eml", i));
// mark the message for deletion
client.DeleteMessage (i);
}
client.Disconnect (true);
}
}
Exceptions
| ArgumentNullException | protocolLogger is . |