public event ExtendedAsyncCompletedEventHandler<TResult> DownloadPop3MessageCompleted
Shows how to connect to a POP3 server and retrieve information of a message asynchronously.
using System; using ComponentPro; using ComponentPro.Net.Mail; ... // Create a new instance of the Pop3 class. Pop3 client = new Pop3(); // 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"); // ... // Download a mail message with sequence number 1. Pop3Message msg = await client.DownloadPop3MessageAsync(1, Pop3EnvelopeParts.MessageInboxIndex | Pop3EnvelopeParts.UniqueId); Console.WriteLine("Message downloaded successfully."); Console.WriteLine("Message ID: {0}, Unique Id: {1}", msg.MessageIdentifier, msg.Subject); // ... // Disconnect. client.Disconnect();
Shows how to connect to a POP3 server and retrieve information of a message asynchronously.
using System; using ComponentPro; using ComponentPro.Net.Mail; ... public void DoDownloadPop3MessagePartsAsync() { // Create a new instance of the Pop3 class. Pop3 client = new Pop3(); // 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"); // ... // Register an event handler. client.DownloadPop3MessageCompleted += client_DownloadPop3MessageCompleted; // Download a mail message with sequence number 1. client.DownloadPop3MessageAsync(1, Pop3EnvelopeParts.MessageInboxIndex | Pop3EnvelopeParts.UniqueId); // ... // Disconnect. client.Disconnect(); } void client_DownloadPop3MessageCompleted(object sender, ExtendedAsyncCompletedEventArgs<Pop3Message> e) { // Pop3 client = (Pop3)sender; if (e.Error != null) Console.WriteLine("Error: " + e.Error.ToString()); else { Console.WriteLine("Message downloaded successfully."); Console.WriteLine("Message ID: {0}, Unique Id: {1}", e.Result.MessageIdentifier, e.Result.Subject); } }