将 MIME 中的附加数据嵌入到电子邮件的 HTML 部分。不链接到附件

Embedding attached data in MIME, to the HTML portion of the email. Not linking to the attached file

我已经生成了这个通过 aws-ses 发送的 MIME 数据。这里是整个 MIME 数据

Content-Type: multipart/mixed;boundary=T4nu9J8b
From: <noreply@noreply.in>
To: <myemail@gmail.com>
Subject: Your Image

--T4nu9J8b
Content-Type: multipart/alternate;boundary=R5I0TJcF

--R5I0TJcF
Content-Type: text/html;charset=utf-8

<h1> Hi!!! </h1><p>Here is your progress report </p><br/> <img alt="Embedded Image" src="cid:testimage.png"/>
--R5I0TJcF
Content-Type: text/plain;charset=utf-8

This is the plain text version of the message.
--R5I0TJcF--
--T4nu9J8b
Content-Type: image/png
Content-Transfer-Encoding: base64
Content-Disposition: attachment ;filename="testimage.png"

iVBORw0KGgoAAAANS...
--T4nu9J8b--

我收到了电子邮件,但图像没有嵌入到 MIME 的 html 部分 img 标签链接到附件

HTML 代码

<img alt="Embedded Image" src="cid:testimage.png"/>

MIME 附件

--T4nu9J8b Content-Type: image/png Content-Transfer-Encoding: base64 Content-Disposition: attachment ;filename="testimage.png"

iVBORw0KGgoAAAANS...
--T4nu9J8b--

结果电子邮件

图片附件部分需要Content-ID

--T4nu9J8b
Content-Type: image/png
Content-ID: <idname>
Content-Transfer-Encoding: base64
Content-Disposition: attachment ;filename="testimage.png"

iVBORw0KGgoAAAANS...
--T4nu9J8b--

Note: Content-ID name should be put in an angular bracket, as given

使用相同的 Content-ID(不带 angular 括号)将其嵌入到标签中

<img alt="Embedded Image" src="cid:idname"/>

这应该允许附加图像显示到 html!

完整资源:http://www.faqs.org/rfcs/rfc2387.html

问题类似于 Embedding attached images in HTML emails 但是我找不到准确的答案。我也会post那里也一样。