MailMessageMimePartTree Property
Gets the root MIME part of the message.

Namespace: MailBee.Mime
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 11.2.0 build 590 for .NET 4.5
Syntax
public MimePart MimePartTree { get; }

Property Value

Type: MimePart
A MimePart object containing the root MIME part of the message.
Remarks

A mail message can be represented as a set of MIME parts which have headers, body, or sub-parts (if this MIME part is multi-part). For instance, a message which consists of the plain text only can be represented as a single MIME part (without any sub-parts).

On the other hand, complex messages having attachments or alternative bodies can be represented as a tree structure. In this case, the given property gets the root MIME part which is associated with the message itself.

To get all MIME parts of the message as an array rather than a tree, call msg.MimePartTree.GetAllParts() (assuming msg is MailMessage instance).

Examples
This sample loads the message from .EML file and displays the size of the root MIME part of the message in bytes.
using System;
using MailBee;
using MailBee.Mime;

class Sample
{
    static void Main(string[] args)
    {
        // Load the message from file.
        MailMessage msg = new MailMessage();
        msg.LoadMessage(@"C:\Docs\TestMail.eml");

        // Display the size of root MIME part in bytes.
        Console.WriteLine(msg.MimePartTree.Size.ToString());
    }
}
See Also