我的目标是修改MIME内容&在电子邮件中添加页脚注释,而不更改其行为。
如果电子邮件内容内容类型为text / plain,那么我将电子邮件内容类型更新为multipart / mixed,如下所示:
Content-Type: multipart/mixed;
Boundary="--=_SAMPLE_MIME_BOUNDARY_"
email original data
----=_SAMPLE_MIME_BOUNDARY_
Content-Type: text/plain;
Content-Transfer-Encoding: 7bit
!-- Sample footer note --!
----=_SAMPLE_MIME_BOUNDARY_--
如果电子邮件内容类型默认为multipart / mixed,那么我更新电子邮件内容如下:
Content-Type: multipart/mixed;
boundary="----=_SAMPLE_MIME_BOUNDARY_"
------=_SAMPLE_MIME_BOUNDARY_
Content-Type: text/plain;
Content-Transfer-Encoding: 8bit
email data
------=_SAMPLE_MIME_BOUNDARY_
Content-Type: application/octet-stream;
name="test_attachment"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="test_attachment"
<<attachment data>>
------=_SAMPLE_MIME_BOUNDARY_
Content-Type: text/plain;
Content-Transfer-Encoding: 7bit;
Content-Disposition: inline;
!-- Sample footer note --!
------=_20160127171644_62291--
但是当我更新电子邮件正文时,Outlook将样本备注视为附件。对于Thunderbird,当我点击向前电子邮件时,它会将页脚视为附件。
所以我的问题是,哪个是在电子邮件中添加页脚文本的最佳方法? 我做对了吗?如果有任何错误,建议更改/精确定位。
答案 0 :(得分:0)
邮件的MIME结构错误。它必须是
multipart/mixed
multipart/alternative
text/plain
text/html
application/octet-stream