TextBodyPartCollectionAdd Method (String) |
Creates a new text body part of the specified content type and appends it to the collection.
Namespace: MailBee.MimeAssembly: MailBee.NET (in MailBee.NET.dll) Version: 12.5.0 build 687 for .NET 4.5
Syntax public TextBodyPart Add(
string contentType
)
Public Function Add (
contentType As String
) As TextBodyPart
Parameters
- contentType
- Type: SystemString
A string specifying the content type of the text part to be created.
Return Value
Type:
TextBodyPartA reference to the newly added text body part.
Exceptions Examples This sample creates a new message, adds XML part to the message, and saves this message to disk.
using MailBee;
using MailBee.Mime;
MailMessage msg = new MailMessage();
msg.BodyParts.Add("text/xml");
msg.BodyParts["text/xml"].Text = "<?xml version=\"1.0\" ?>";
msg.SaveMessage(@"C:\Temp\TestMail.eml");
Imports MailBee
Imports MailBee.Mime
Dim msg As New MailMessage
msg.BodyParts.Add("text/xml")
msg.BodyParts("text/xml").Text = "<?xml version=""1.0"" ?>"
msg.SaveMessage("C:\Temp\TestMail.eml")
See Also