我在一個將多個文件附加到HTML電子郵件的PHP應用程序中生成電子郵件。其中一些文件是Excel電子表格,其中一些文件是公司徽標,需要將其嵌入到HTML中,以便默認情況下使用Content-ID和cid標識符加載以引用附加圖像。在Thunderbird中爲嵌入的電子郵件圖像使用Content-ID和cid
就我所見,我的語法是正確的,但圖像不會以內聯方式加載(但它們已成功附加)。
From: [email protected]
Reply-To: [email protected]
MIME-Version: 1.0
Content-type: multipart/mixed;boundary="d0f4ad49cc20d19bf96d4adf9322d567"
Message-Id: <[email protected]>
Date: Tue, 21 Apr 2015 12:54:59 -0400 (EDT)
--d0f4ad49cc20d19bf96d4adf9322d567
Content-type: text/html; charset=utf-8
Content-transfer-encoding: 8bit
<html>
Html message goes here, followed by email.<br/>
<img src="cid:mylogo" />
</html>
--d0f4ad49cc20d19bf96d4adf9322d567
Content-type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet; name=excelsheet.xlsx
Content-Description: excelsheet.xlsx
Content-Disposition: attachment;
filename="excelsheet.xlsx"; size=24712;
Content-transfer-encoding:base64
[base64 encoded string goes here.]
--b19e863e2cf66b40db1d138b7009010c
Content-Type: image/jpeg;
name="mylogo.jpg"
Content-transfer-encoding:base64
Content-ID: <mylogo>
Content-Disposition: inline;
filename="mylogo.jpg"; size=7579;
[base64 encoded string goes here.]
--b19e863e2cf66b40db1d138b7009010c--
任何人都可以看到一個明顯的原因,爲什麼圖像不會按預期嵌入?
編輯
注意此行爲是不一般到所有的電子郵件客戶端。到目前爲止僅在Thunderbird中提到。
這實際上似乎是特定於Mozilla Thunderbird中在Linux(到目前爲止)。電子郵件通過GMail通過嵌入式圖像正確顯示,並且通過Windows上的Thunderbird看似正確。 – fred2
更正 - 無法在Windows上的Thunderbird上工作 – fred2
Thunderbird默認情況下是否禁用嵌入式圖像? – undefined