MailMessage Mail = new MailMessage();
Mail.From = new MailAddress("moss@xxx.com.vn");
Mail.To.Add("cmtuan@xxx.com.vn");
Mail.Subject = "This is Image Test.";
Mail.Body = "This is the body of the email";
LinkedResource LinkedImage = new LinkedResource(@"DataFiles\Birthday\logo1.jpg");
LinkedImage.ContentId = "MyPic";
//Added the patch for Thunderbird as suggested by Jorge
LinkedImage.ContentType = new ContentType(MediaTypeNames.Image.Jpeg);
AlternateView htmlView = AlternateView.CreateAlternateViewFromString(
"You should see image next to this line. <img src=cid:MyPic>",
null, "text/html");
htmlView.LinkedResources.Add(LinkedImage);
Mail.AlternateViews.Add(htmlView);
SmtpClient smtp = new SmtpClient("webmail.xxx.com.vn", 25);
try
{
smtp.Send(Mail);
}
catch (SmtpException ex)
{
//Logger.LogException(ex);
}