TextBodyPartCollectionAdd Method (TextBodyPart)
Adds the specified TextBodyPart object to the collection.

Namespace: MailBee.Mime
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 12.5.0 build 687 for .NET 4.5
Syntax
public TextBodyPart Add(
	TextBodyPart part
)

Parameters

part
Type: MailBee.MimeTextBodyPart
A TextBodyPart object to be added.

Return Value

Type: TextBodyPart
A reference to the added text body part (which is part object).
Exceptions
ExceptionCondition
MailBeeInvalidArgumentExceptionpart is a null reference (Nothing in Visual Basic).
Examples
This sample creates a new message, loads another message from .EML file, and adds all text parts of the second message to the TextBodyPartCollection of the first message.
// 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 msg1 = new MailMessage();
MailMessage msg2 = new MailMessage();
msg2.LoadMessage(@"C:\Docs\TestMail.eml");
for (int i = 0; i < msg2.BodyParts.Count; i++)
{
    msg1.BodyParts.Add(msg2.BodyParts[i]);
}
msg1.SaveMessage(@"C:\Temp\Result.eml");
See Also