ImapDownloadEntireMessage Method
Completely downloads the specified message from the server.

Namespace: MailBee.ImapMail
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 12.4 build 677 for .NET 4.5
Syntax
public MailMessage DownloadEntireMessage(
	long messageIndex,
	bool indexIsUid
)

Parameters

messageIndex
Type: SystemInt64
The ordinal position or UID of the message in the currently selected folder (for ordinal message numbers, can be negative, i.e. -1 denotes the last e-mail in the folder).
indexIsUid
Type: SystemBoolean
If true, messageIndex is treated as UID; otherwise, as ordinal message number.

Return Value

Type: MailMessage
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).
Exceptions
ExceptionCondition
MailBeeExceptionAn error occurred and ThrowExceptions is true.
Remarks

If more than one message is downloaded, it's recommended to use DownloadEntireMessages(String, Boolean) method when possible, since it is capable of downloading multiple messages in a batch.

To make messages SEEN upon downloading, change SetSeenForEntireMessages property value to true before calling this method.

For advanced purposes, use DownloadEnvelopes(String, Boolean, EnvelopeParts, Int32, String, String). With IMAP envelopes, you can get extra flags, and more.

Examples
This sample downloads the first message from an inbox on an IMAP4 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).
using System;
using MailBee;
using MailBee.ImapMail;
using MailBee.Mime;

class Sample
{
    static void Main(string[] args)
    {
        Imap imp = new Imap();

        // Connect to the server, login and select inbox.
        imp.Connect("imap.somehost.com");
        imp.Login("jdoe@somehost.com", "secret");
        imp.SelectFolder("INBOX");

        // Save message as C:\Temp\index.htm
        MailMessage msg = imp.DownloadEntireMessage(1, false);
        msg.Parser.PlainToHtmlMode = PlainToHtmlAutoConvert.IfNoHtml;
        msg.SaveHtmlAndRelatedFiles(@"C:\Temp\index.htm");

        // Disconnect from the server.
        imp.Disconnect();
    }
}
See Also