通过电子邮件将图像作为嵌入在身体中的图像发送时出现问题。 图像文件显示为一个附件,这没问题,但是内联图像部分只显示为一个红色的 x。
这是我目前掌握的情况
LinkedResource inline = new LinkedResource(filePath);
inline.ContentId = Guid.NewGuid().ToString();
MailMessage mail = new MailMessage();
Attachment att = new Attachment(filePath);
att.ContentDisposition.Inline = true;
mail.From = from_email;
mail.To.Add(data.email);
mail.Subject = "Client: " + data.client_id + " Has Sent You A Screenshot";
mail.Body = String.Format(
"<h3>Client: " + data.client_id + " Has Sent You A Screenshot</h3>" +
@"<img src=""cid:{0}"" />", inline.ContentId);
mail.IsBodyHtml = true;
mail.Attachments.Add(att);