MailMessageIsBodyAvail Method |
Namespace: MailBee.Mime
Exception | Condition |
---|---|
MailBeeInvalidArgumentException | bodyFormat is a null reference (Nothing in Visual Basic). |
A message may contain original MIME parts (they had already been present in the existing message when it was parsed) and MIME parts added by MailBee (for instance, they may appear when the existing message gets parsed by MailBee and MailBee automatically creates plain-text part if only HTML part is available in the message).
To access text bodies of the message, you can use BodyPlainText, BodyHtmlText, and BodyParts properties.
To make the plain-text body be automatically created from the HTML body if the plain-text body is missing, set HtmlToPlainMode property to IfNoPlain value. See BodyPlainText and BodyHtmlText topics for more information.
// To use the code below, import MailBee namespaces at the top of your code. using MailBee; using MailBee.Mime; // The actual code (put it into a method of your class) MailMessage msg = new MailMessage(); msg.LoadMessage(@"C:\Docs\TestMail.eml"); if (msg.IsBodyAvail("text/xml", false)) { Console.WriteLine("Message does contain XML body."); } else { Console.WriteLine("Message does not contain XML body."); }