【发布时间】:2012-05-31 01:20:03
【问题描述】:
我正在编写包含几个嵌入图像的电子邮件通讯。标题看起来像:
... (snip)
MIME-Version: 1.0
Content-type: multipart/related;
boundary="xyzzy1220091"
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
--xyzzy1220091
Content-type: text/html; charset=iso-8859-1; name="tempE924AAC7.html"
Content-description: html
Content-transfer-encoding: 7bit
Content-disposition: INLINE
(HTML newsletter here)
--xyzzy1220091
Content-type: image/jpeg; name="cabecera.jpg"
Content-description: cabecera
Content-transfer-encoding: base64
Content-disposition: inline; filename="cabecera.jpg";
Content-ID: <cabecera>
这在 Gmail、Hotmail、Apple Mail 中都能正常工作...我测试过的所有东西,除了 Outlook 2010。在其中,它将显示空邮件以及 HTML 和 JPG 文件作为附件在单独的选项卡中;如果您单击 HTML,它会显示一个预览按钮,其中包含有关仅显示来自受信任来源的预览的警告。
如果我不以多部分/相关附件的形式发送时事通讯,而是以 HTML 电子邮件的形式发送:
Content-type: text/html
Content-transfer-encoding: quoted-printable
然后它在 Outlook 中完美显示...但是当然,我不能添加内嵌图像。
【问题讨论】:
-
嵌入图像不是很好的跨客户端,请参阅此处获取我的来源 -> campaignmonitor.com/blog/post/1759/embedding-images-revisited 在线托管图像并使用对它们的绝对引用不是更好吗?
-
在我的测试中,如果图像托管在其他地方,大多数电子邮件客户端都会阻止它们; OTOH,如果您将它们嵌入电子邮件中,几乎所有客户都会显示它们。
-
至于原来的问题,我通过使用“multipart/alternative”解决了,没有将HTML部分附加为文件。
-
请发布您的解决方案,以便其他人可以学习。
标签: image debugging html-email outlook-2010 multipart