Occurs when a message was downloaded from the server.
The event handler receives an argument of type Pop3MessageDownloadedEventArgs containing data related to this event. The following Pop3MessageDownloadedEventArgs properties provide information specific to this event.
| Property | Description |
|---|---|
| DataLength | Gets the length (in bytes) of the server response containing the downloaded message data. |
| DownloadedMessage | Gets or sets the mail message which had been downloaded. |
| MessageNumber | Gets the message number (ordinal position in the mailbox) of the downloaded message. |
| State | Gets a reference to the object which was supplied by the developer in state parameter of asynchronous methods of the mailer components. |
If only message headers were requested for download (e.g. DownloadMessageHeaders 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.
This sample downloads headers of the last 10 messages in the inbox. For each downloaded header, the corresponding status message is displayed.
[C#] 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(); } }
[Visual Basic] Imports System Imports MailBee Imports MailBee.Pop3Mail Imports MailBee.Mime Class Sample ' MessageDownloaded event handler. Private Shared Sub OnMessageDownloaded(ByVal sender As Object, _ ByVal e As Pop3MessageDownloadedEventArgs) Console.WriteLine("The header of the message #" & e.MessageNumber & _ " has been downloaded") End Sub ' The actual code. Shared Sub Main(ByVal args As String()) Dim pop As New Pop3 ' Subscribe to the MessageDownloaded event. AddHandler pop.MessageDownloaded, AddressOf OnMessageDownloaded pop.Connect("mail.domain.com") pop.Login("jdoe", "secret") ' Download headers of the last 10 messages in the inbox. Dim msgs As MailMessageCollection = pop.DownloadMessageHeaders(pop.InboxMessageCount - 9, 10) pop.Disconnect() End Sub End Class
Pop3 Class | MailBee.Pop3Mail Namespace | DownloadEntireMessage | DownloadEntireMessages | DownloadMessageHeader | DownloadMessageHeaders