//图片将以附件方式发送
ContentType ct = new ContentType(); ct.MediaType = MediaTypeNames.Image.Jpeg; Attachment data = new Attachment(filePath + "Images/email.png", ct); data.ContentId = "Email3"; mail.Attachments.Add(data);
//图片插入正文中
AlternateView htmlBody = AlternateView.CreateAlternateViewFromString(body, null, "text/html");
string filePath = AppDomain.CurrentDomain.BaseDirectory;
ContentType Jpeg = new ContentType();//设置文件类型
Jpeg.MediaType = MediaTypeNames.Image.Jpeg;
LinkedResource lrImage = new LinkedResource(filePath + "Images/11floor.jpg", Jpeg);
lrImage.ContentId = "Email001";
htmlBody.LinkedResources.Add(lrImage);