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
public MimePart MimePartTree { get; }

Property Value

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

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).

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();

        // Display the size of root MIME part in bytes.
See Also