MailMessageMimePartTree Property |
Namespace: MailBee.Mime
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).
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()); } }