我已经生成了此MIME数据,该数据通过aws-ses发送。这里是整个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--
结果电子邮件
答案 0 :(得分:0)
图像附件部分需要Content-ID
--T4nu9J8b
Content-Type: image/png
Content-ID: <idname>
Content-Transfer-Encoding: base64
Content-Disposition: attachment ;filename="testimage.png"
iVBORw0KGgoAAAANS...
--T4nu9J8b--
注意:Content-ID名称应放在尖括号中,如给定
使用相同的Content-ID将其嵌入到标签中(不带尖括号)
<img alt="Embedded Image" src="cid:idname"/>
这应该允许将附件图像显示在html中!
完整资源:http://www.faqs.org/rfcs/rfc2387.html
类似的问题 Embedding attached images in HTML emails 但是我找不到准确的答案。我也要在那张贴。