Pop3DownloadEntireMessage Method |
Namespace: MailBee.Pop3Mail
Exception | Condition |
---|---|
MailBeeException | An error occurred and ThrowExceptions is true. |
If more than one message is downloaded, it's recommended to use DownloadEntireMessages(Int32, Int32) method when possible, since it can operate faster if the server supports pipelining and many small messages are downloaded.
However, if you're dealing with large e-mails (more than 1MB), it's recommended to download and process them one-by-one to avoid out-of-memory issues. Also, set List flag in InboxPreloadOptions property value prior to calling Login(String, String, String, String, AuthenticationMethods, AuthenticationOptions, SaslMethod) method. This will eliminate memory buffer re-allocations during downloading. You can also use both DownloadEntireMessage(Int32) method to download large e-mails and DownloadEntireMessages(Int32, Int32) overload to download ranges of smaller e-mails between larger ones.
// 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();