ImapQuickDownloadMessages Method (String, String, String, String) |
Namespace: MailBee.ImapMail
public static MailMessageCollection QuickDownloadMessages( string serverName, string accountName, string password, string folderName )
Exception | Condition |
---|---|
MailBeeException | An error occurred. |
This method does not delete any messages in the folder.
An account on the mail server is guaranteed to contain at least "Inbox" folder. The "Inbox" name is case-sensitive ("Inbox", "inbox", and "INBOX" are equivalent). Other folder names, however, may be case-senstive depending on the server implementation.
Since MailBee is capable of downloading multiple messages in a batch, using this method is much more efficient than calling QuickDownloadMessage(String, String, String, String, Int32, Int32) method multiple times.
Note |
---|
Static methods still require the valid license key be assigned to MailBee.Global.LicenseKey property (by either setting in in the code or in the config file such as app.config). All samples in MailBee documentation assume the license key is already set in the config file. |
This method is not async, it's recommended (and in case of UWP platform it's mandatory) to use sync methods like DownloadEntireMessagesAsync(String, Boolean).
// To use the code below, import MailBee namespaces at the top of your code. using MailBee; using MailBee.ImapMail; using MailBee.Mime; // The actual code (put it into a method of your class). MailMessageCollection msgs = Imap.QuickDownloadMessages("imap.host.com", "login", "password", "Inbox"); foreach (MailMessage msg in msgs) { if (msg.HasAttachments) { Console.WriteLine("Message #" + msg.IndexOnServer + " has " + msg.Attachments.Count + " attachment(s)"); } }