【发布时间】:2019-12-14 13:41:21
【问题描述】:
我正在尝试在我的应用程序 (asp.net C#) 上发送一封电子邮件,我尝试了 SO 上的每个答案以在电子邮件正文上显示 base64 图像。但到目前为止还没有锻炼。如果有人帮助我解决这个问题,那就太好了。 这是 HTML 代码
<tr style="min-height:60px;margin-top:50px;width:100%;padding: 0px;color: black;clear: left;text-align: center;border: 1px solid black;margin-top: 40px;margin-bottom:40px;">
<td style="margin-top:100px;height:60px; background-position-x: center;background-position-y: center;background-size: cover;background-repeat: no-repeat;">
<img src="##FooterImage" style="margin-left: 73%;" />
</td>
</tr>
emailBodyLoaded = emailBodyLoaded.Replace("##FooterImage", "'cid:" + iconResource.ContentId + @"'");
byte[] iconBytes = new BLL.Core.Domain.items(new ageContext()).GetitemsLogo(inspData.Rows[0]["ItemID"].ToString());
System.IO.MemoryStream iconBitmap = new System.IO.MemoryStream(iconBytes);
LinkedResource iconResource = new LinkedResource(iconBitmap, MediaTypeNames.Image.Jpeg);
iconResource.ContentId = "Icon";
【问题讨论】:
-
Base64 在大多数电子邮件客户端中不起作用。使用普通图片。
-
你能给我一个使用普通图像的例子吗
-
查看链接的帖子。这是一个完整的工作示例。
标签: c# html asp.net asp.net-mvc-4