TextBodyPartCollectionAdd Method (TextBodyPart) |
Namespace: MailBee.MimeAssembly: MailBee.NET (in MailBee.NET.dll) Version: 12.5.0 build 687 for .NET 4.5
Syntax public TextBodyPart Add(
TextBodyPart part
)
Public Function Add (
part As TextBodyPart
) As TextBodyPart
Parameters
- part
- Type: MailBee.MimeTextBodyPart
A TextBodyPart object to be added.
Return Value
Type:
TextBodyPartA reference to the added text body part (which is
part object).
Exceptions 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.
using MailBee;
using MailBee.Mime;
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");
Imports MailBee
Imports MailBee.Mime
Dim i As Integer
Dim msg1 As New MailMessage
Dim msg2 As New MailMessage
msg2.LoadMessage("C:\Docs\TestMail.eml")
For i = 0 To msg2.BodyParts.Count - 1
msg1.BodyParts.Add(msg2.BodyParts(i))
Next
msg1.SaveMessage("C:\Temp\Result.eml")
See Also