TextBodyPartCollectionItem Property (String) |
Gets a reference to the
TextBodyPart object representing the text part of the specified content type.
Namespace: MailBee.MimeAssembly: MailBee.NET (in MailBee.NET.dll) Version: 12.5.0 build 687 for .NET 4.5
Syntax public TextBodyPart this[
string contentType
] { get; }
Public ReadOnly Default Property Item (
contentType As String
) As TextBodyPart
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 Examples This sample loads the message from .EML file and displays the contents of XML body of the message (if any).
using MailBee;
using MailBee.Mime;
MailMessage msg = new MailMessage();
msg.LoadMessage(@"C:\Docs\TestMail.eml");
if (msg.BodyParts["text/xml"] != null)
{
Console.WriteLine(msg.BodyParts["text/xml"].Text);
}
Imports MailBee
Imports MailBee.Mime
Dim msg As New MailMessage
msg.LoadMessage("C:\Docs\TestMail.eml")
If Not msg.BodyParts("text/xml") Is Nothing Then
Console.WriteLine(msg.BodyParts("text/xml").Text)
End If
See Also