【发布时间】:2014-08-09 21:23:38
【问题描述】:
我有以下工作正常的代码, 我可以发送带有附件的电子邮件。
我正在尝试将图像的宽度调整为100px;
msg.IsBodyHtml = true;
Attachment inlineLogo = new Attachment(@"C:\Desktop\Image.jpg");
msg.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
msg.Body = "<htm><body> <img src=\"cid:" + contentID + "\"> </body></html>";
编辑:
我试过<img width="100" src=\"cid:" + contentID + "\"> 但它不起作用,
【问题讨论】: