 | Pop3Client(IProtocolLogger) Constructor |
Initializes a new instance of the
Pop3Client class.
Namespace: MailKit.Net.Pop3Assembly: MailKit (in MailKit.dll) Version: 4.10.0
Syntaxpublic Pop3Client(
IProtocolLogger protocolLogger
)
Parameters
- protocolLogger IProtocolLogger
- The protocol logger.
Exceptions
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.
Examplepublic 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);
message.WriteTo (string.Format ("{0}.msg", i));
client.DeleteMessage (i);
}
client.Disconnect (true);
}
}
See Also