MailMessageIsBodyAvail Method
Indicates if the body of the specified format is present in the message.

Namespace: MailBee.Mime
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 11.2.0 build 590 for .NET 4.5
public bool IsBodyAvail(
	string bodyFormat,
	bool originalBodyOnly


Type: SystemString
The content type of the body to be searched (e.g. text/plain).
Type: SystemBoolean
Indicates if only the original parts of the message should be processed.

Return Value

Type: Boolean
true if the body of specified format is present in the message; otherwise, false.
MailBeeInvalidArgumentExceptionbodyFormat 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.

This sample loads the message from .EML file and checks if it has an XML body.
// 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();
if (msg.IsBodyAvail("text/xml", false))
    Console.WriteLine("Message does contain XML body.");
    Console.WriteLine("Message does not contain XML body.");
See Also