It's quite easy - during email creation, you need to invoke
AddAttachment method multiple times.
Attachments are integral part of an email message.
MailBuilder builder = new MailBuilder();
builder.From.Add(new MailBox("email@example.com", "Alice"));
builder.To.Add(new MailBox("firstname.lastname@example.org", "Bob"));
builder.Subject = "Test";
builder.Text = "This is a plain text message.";
/* Read attachment from disk, add it to Attachments collection */
MimeData attachment1 = builder.AddAttachment(@"../image1.jpg");
MimeData attachment2 = builder.AddAttachment(@"../image2.jpg");
IMail email = builder.Create();
Now you can send the email:
using (Smtp smtp = new Smtp())
There is also an
AddAttachment overload that allow you to create an attachment from a byte array.
You can use retuned
MimeData object to set/change attachment's name or content type, or any other MIME property.