.NET Framework Mail with Attachment


Example

MailMessage represents mail message which can be sent further using SmtpClient class. Several attachments (files) can be added to mail message.

using System.Net.Mail;

using(MailMessage myMail = new MailMessage())
{
     Attachment attachment = new Attachment(path);
     myMail.Attachments.Add(attachment);

     // further processing to send the mail message

}