TextBodyPartCollectionAdd Method (String)
Creates a new text body part of the specified content type and appends it to the collection.

Namespace: MailBee.Mime
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 11.2.0 build 590 for .NET 4.5
Syntax
public TextBodyPart Add(
	string contentType
)

Parameters

contentType
Type: SystemString
A string specifying the content type of the text part to be created.

Return Value

Type: TextBodyPart
A reference to the newly added text body part.
Exceptions
ExceptionCondition
MailBeeInvalidArgumentExceptioncontentType is a null reference (Nothing in Visual Basic).
Examples
This sample creates a new message, adds XML part to the message, and saves this message to disk.
// 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.Add("text/xml");
msg.BodyParts["text/xml"].Text = "<?xml version=\"1.0\" ?>";
msg.SaveMessage(@"C:\Temp\TestMail.eml");
See Also