TextBodyPartCollectionHtml Property
Gets a reference to the HTML text part of the message.

Namespace: MailBee.Mime
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 11.2.0 build 590 for .NET 4.5
public TextBodyPart Html { get; }

Property Value

Type: TextBodyPart
A reference to TextBodyPart object representing the HTML body and its headers.

If the message contains more than one HTML body, this property will return the first found. If the message does not contain HTML body, accessing this property will create new one.

If the above behaviour is not suitable for your case, you can always iterate through the collection and examine each text part as it appears in the message.

This sample creates a new message with HTML body part and saves this message to disk. In real-world apps, however, it would be easier to set HTML body contents using BodyHtmlText property.
// 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.BodyParts.Html.Text = "<i>Hello</i>, <b>World</b>!";
See Also