Click or drag to resize
MimeKit

Pop3Client(IProtocolLogger) Constructor

Initializes a new instance of the Pop3Client class.

Namespace: MailKit.Net.Pop3
Assembly: MailKit (in MailKit.dll) Version: 4.7.1
Syntax
C#
public Pop3Client(
	IProtocolLogger protocolLogger
)

Parameters

protocolLogger  IProtocolLogger
The protocol logger.
Exceptions
ExceptionCondition
ArgumentNullExceptionprotocolLogger is null.
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}.msg", i));

            // mark the message for deletion
            client.DeleteMessage (i);
        }

        client.Disconnect (true);
    }
}
See Also