的身体表现我发现这个解决方案显示在电子邮件的正文中的图像: Add image to body of an email如何删除图像以附件形式,但在电子邮件
,它工作正常,但它也增加了图像以附件的形式电子邮件。
Attachment inlineLogo = new Attachment(EmailLogo.ImageUrl);
mailMsg.Attachments.Add(inlineLogo);
string contentID = "Image";
inlineLogo.ContentId = contentID;
//To make the image display as inline and not as attachment
inlineLogo.ContentDisposition.Inline = true;
inlineLogo.ContentDisposition.DispositionType = DispositionTypeNames.Inline;
//To embed image in email
mailMsg.Body = "<htm><body> <img height=\"49\" width=\"169\" src=\"cid:" + contentID + "\"> </body></html>";
还有就是代码的注释行显示为内联,而不是作为附件,但该行没有工作,因为图像仍然被附加到电子邮件:
//To make the image display as inline and not as attachment
inlineLogo.ContentDisposition.Inline = true;
inlineLogo.ContentDisposition.DispositionType = DispositionTypeNames.Inline;
哪有我停止将图像附加到电子邮件中?
请看到这个帖子:http://stackoverflow.com/questions/18358534/send-inline-image-in-email – Creep
是L从'缺少'mailMsg.Body =“一个错字“;'行,或者它出现在你的主应用程序中? –
Takarii
看看[这篇文章](http://stackoverflow.com/a/32767496/3110834)的一些选项。 –