Gets the root MIME part of the message.
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.
[C#] 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()); } }
[Visual Basic] Imports System Imports MailBee Imports MailBee.Mime Module Sample Sub Main(ByVal args As String()) ' Load the message from file. Dim msg As New MailMessage msg.LoadMessage("C:\Docs\TestMail.eml") ' Display the size of root MIME part in bytes. Console.WriteLine(msg.MimePartTree.Size.ToString()) End Sub End Module
MailMessage Class | MailBee.Mime Namespace | GetAllParts