Pop3QuickDownloadMessage Method (String, String, String, Int32)
Completely downloads the specified message from the server, in a single line of code.

Namespace: MailBee.Pop3Mail
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 11.2.0 build 590 for .NET 4.5
Syntax
public static MailMessage QuickDownloadMessage(
	string serverName,
	string accountName,
	string password,
	int index
)

Parameters

serverName
Type: SystemString
The name or IP address of the POP3 server.
accountName
Type: SystemString
The user account name on the server.
password
Type: SystemString
The password of the user account on the server.
index
Type: SystemInt32
The ordinal position of the message in the inbox, starting at 1 (can be negative, i.e. -1 denotes the last e-mail in the inbox).

Return Value

Type: MailMessage
A MailMessage object containing the downloaded message (including the header and all the body parts and attachments).
Exceptions
ExceptionCondition
MailBeeExceptionAn error occurred.
Remarks

This method does not delete any messages in the inbox.

The common use of this method is to quickly receive the message when its index in the inbox is already known. For instance, QuickDownloadMessages(String, String, String, Int32) method was used to download headers for all messages in the inbox and build the message list where the user can click a particular message to view it completely. Once the user selected the message to be viewed, the application passes its index in the message list as a value of index parameter of QuickDownloadMessage(String, String, String, Int32, Int32) method to download the selected message (if the message list index is zero-based, the developer should also add 1 to the index value).

Note 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 DownloadEntireMessageAsync(Int32).

Examples
This sample downloads the first message in the inbox and saves it as .EML file to disk.
// 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).
MailMessage msg = Pop3.QuickDownloadMessage("pop.server.com",
    "login", "password", 1);
msg.SaveMessage(@"C:\Temp\message.eml");
See Also