TextBodyPartCollectionItem Property (String)
Gets a reference to the TextBodyPart object representing the text part of the specified content type.

Namespace: MailBee.Mime
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 11.2.0 build 590 for .NET 4.5
Syntax
public TextBodyPart this[
	string contentType
] { get; }

Parameters

contentType
Type: SystemString
A string containing the content type of the text part to be searched (such as text/plain).

Property Value

Type: TextBodyPart
A TextBodyPart object representing the text part of the specified content type, or a null reference (Nothing in Visual Basic) if the text part of the specified content type does not exist in the collection.
Exceptions
ExceptionCondition
MailBeeInvalidArgumentExceptioncontentType is a null reference (Nothing in Visual Basic).
Examples
This sample loads the message from .EML file and displays the contents of XML body of the message (if any).
// 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.BodyParts["text/xml"] != null)
{
    Console.WriteLine(msg.BodyParts["text/xml"].Text);
}
See Also