【问题标题】:Email issue with inline image内嵌图像的电子邮件问题
【发布时间】:2019-03-08 23:42:53
【问题描述】:

我在通过 Microsoft Graph API 发送的电子邮件时遇到问题。当我发送包含签名作为内联图像的消息时,由于某种原因,它会在消息正文中显示图像以及附件。在 Apples 邮件客户端中,我得到图像并在占位符下方点击下载。在 iphone 上的 Outlook 移动邮件中,我在签名 png 下方得到一个大的空白图像。然后在我的桌面客户端中,我可以看到所需的图像。下面是我如何将图像指定为内联的代码

 <p style="line-height: 24px">
 <img width=400  id="Picture_x0020_1" src="cid:3db07156-343b-4ed8-b2b3-7a4f5cdda90b" alt=logoemail>
 </p>

【问题讨论】:

  • 这不是我的问题,因为被列为受支持的客户端之一的问题是 Apple iOS 邮件客户端。
  • 嵌入图像不起作用。尝试托管它们。如果嵌入有效,我每个月都会发送 TB 级的图片附件到电子邮件中。

标签: html html-email email-attachments


【解决方案1】:

您必须在电子邮件中添加类似于以下内容的部分:

... header ...
Content-Type: multipart/related; boundary="Image_20190308"
--Image_20190308
Content-Type: multipart/alternative; boundary="this_is_the_html_part"
--this_is_the_html_part
<p style="line-height: 24px">
<img width=400  id="Picture_x0020_1" src="cid:3db07156-343b-4ed8-b2b3-7a4f5cdda90b" alt=logoemail>
</p>
--this_is_the_html_part--
--Image_20190308
Content-Type: image/gif; name="original_name.gif"
Content-Disposition: inline; filename="original_name.gif"
Content-Transfer-Encoding: base64
Content-ID: <3db07156-343b-4ed8-b2b3-7a4f5cdda90b>
X-Attachment-Id: 3db07156-343b-4ed8-b2b3-7a4f5cdda90b

... insert base64 data here
--Image_20190308--

【讨论】:

  • 错了,这部分是由office 365的ms graph api处理的,我必须通过base 64编码将图像作为附件发送,然后使用cid引用附件
猜你喜欢
  • 2016-02-22
  • 1970-01-01
  • 1970-01-01
  • 2011-04-22
  • 2013-08-23
  • 1970-01-01
相关资源
最近更新 更多