Pop3MessageDownloaded Event |
Namespace: MailBee.Pop3Mail
If only message headers were requested for download (e.g. DownloadMessageHeaders(Int32, Int32, Int32) method was called), this event is raised when a message header is downloaded.
When multiple messages are downloaded, this event is raised for every message (or message header) which was downloaded.
using System; using MailBee; using MailBee.Pop3Mail; using MailBee.Mime; class Sample { // MessageDownloaded event handler. private static void OnMessageDownloaded(object sender, Pop3MessageDownloadedEventArgs e) { Console.WriteLine("The header of the message #" + e.MessageNumber + " has been downloaded"); } // The actual code. static void Main(string[] args) { Pop3 pop = new Pop3(); // Subscribe to the MessageDownloaded event. pop.MessageDownloaded += new Pop3MessageDownloadedEventHandler(OnMessageDownloaded); pop.Connect("mail.domain.com"); pop.Login("jdoe", "secret"); // Download headers of the last 10 messages in the inbox. MailMessageCollection msgs = pop.DownloadMessageHeaders(pop.InboxMessageCount - 9, 10); pop.Disconnect(); } }