AttachmentCollectionAdd Method (Attachment)
Adds the specified Attachment object 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 void Add(
	Attachment attach
)

Parameters

attach
Type: MailBee.MimeAttachment
The Attachment object which should be added.
Exceptions
ExceptionCondition
MailBeeInvalidArgumentExceptionattach is a null reference (Nothing in Visual Basic).
Examples
This sample loads two messages from .EML files, adds all attachments of the second message to the first message, and saves the first message (which now includes all the original plus added attachments) 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 msg1 = new MailMessage();
msg1.LoadMessage(@"C:\Docs\TestMail1.eml");

MailMessage msg2 = new MailMessage();
msg2.LoadMessage(@"C:\Docs\TestMail2.eml");

for (int i = 0; i < msg2.Attachments.Count; i++)
{
    msg1.Attachments.Add(msg2.Attachments[i]);
}
msg1.SaveMessage(@"C:\Temp\TestMail1.eml");
See Also