Monday, March 8, 2010

Embed image in Email using System.Net.Mail

邮件中嵌入图片
Embed image in email using System.Net.Mail.
AlternateView htmlView = AlternateView.CreateAlternateViewFromString("<img src='cid:Logo' >",null "text/html");
LinkedResource logo = new LinkedResource("Your file");
logo
.ContentId = "Logo";
htmlView
.LinkedResources.Add(ADSKlogo);
message
.AlternateViews.Add(htmlView);
You can add multiple images in your  mail, but you need add the cid: as the prefix in the src attribution in the img tag.

No comments:

Post a Comment