Completely downloads the specified message from the server.
On success, a MailMessage object containing the entire message, including the message header, all the body parts and attachments; otherwise, a null reference (Nothing in Visual Basic).
If more than one message is downloaded, it's recommended to use DownloadEntireMessages method when possible, since it can operate faster if the server supports pipelining and many small messages are downloaded.
| Exception Type | Condition |
|---|---|
| MailBeeException | An error occurred and ThrowExceptions is true. |
This sample downloads the last message from an inbox on a POP3 server, saves it as index.htm file, and also saves the embedded pictures and other linked objects, making it possible to open index.htm file in a browser and have the message being correctly displayed (including all the graphics, styles, etc).
[C#] // To use the code below, import MailBee namespaces at the top of your code. using MailBee; using MailBee.Pop3Mail; using MailBee.Mime; // The actual code (put it into a method of your class). Pop3 pop = new Pop3(); pop.Connect("mail.domain.com"); pop.Login("jdoe", "secret"); MailMessage msg = pop.DownloadEntireMessage(pop.InboxMessageCount); msg.Parser.PlainToHtmlMode = PlainToHtmlAutoConvert.IfNoHtml; msg.SaveHtmlAndRelatedFiles(@"C:\Temp\index.htm"); pop.Disconnect();
[Visual Basic] ' To use the code below, import MailBee namespaces at the top of your code. Imports MailBee Imports MailBee.Pop3Mail Imports MailBee.Mime ' The actual code (put it into a method of your class). Dim pop As New Pop3 pop.Connect("mail.domain.com") pop.Login("jdoe", "secret") Dim msg As MailMessage msg = pop.DownloadEntireMessage(pop.InboxMessageCount) msg.Parser.PlainToHtmlMode = PlainToHtmlAutoConvert.IfNoHtml msg.SaveHtmlAndRelatedFiles("C:\Temp\index.htm") pop.Disconnect()
Pop3 Class | MailBee.Pop3Mail Namespace | DownloadEntireMessages