以下是我的雷鸟收到的电子邮件的源代码。 我找不到任何语法错误,它在gmail中运行良好。 但对于hotmail和thunderbird,附件被破坏,内容空白...... 我试了很长时间才解决这个问题。有什么帮助吗?
Subject: MySubject
From: testing@test.com
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="02f05ee7d40220f0ebab50ef7440ca55"
Content-Transfer-Encoding: 7bit
Cc: cc@cc.com
Message-Id: <20161123030114.97B04DCD682@server.com>
Date: Wed, 23 Nov 2016 11:01:14 +0800 (MYT)
--02f05ee7d40220f0ebab50ef7440ca55
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: 8bit
<p>Test</p>
--02f05ee7d40220f0ebab50ef7440ca55
Content-Type: application/pdf; name="Attachment.pdf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="Attachment.pdf"
PDF ATTACHMENT CODES HERE
PDF ATTACHMENT CODES HERE
PDF ATTACHMENT CODES HERE
PDF ATTACHMENT CODES HERE
PDF ATTACHMENT CODES HERE
--02f05ee7d40220f0ebab50ef7440ca55--
答案 0 :(得分:0)
感谢@mkl的回答。 经过一些修改后,我的代码才有效!!
<强> "There must be a empty line between header and content."
强>
是重点
Subject: MySubject
From: testing@test.com
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="02f05ee7d40220f0ebab50ef7440ca55"
Content-Transfer-Encoding: 7bit
Cc: cc@cc.com
Message-Id: <20161123030114.97B04DCD682@server.com>
Date: Wed, 23 Nov 2016 11:01:14 +0800 (MYT)
--02f05ee7d40220f0ebab50ef7440ca55
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: 8bit
<p>Test</p>
--02f05ee7d40220f0ebab50ef7440ca55
Content-Type: application/pdf; name="Attachment.pdf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="Attachment.pdf"
PDF ATTACHMENT CODES HERE
PDF ATTACHMENT CODES HERE
PDF ATTACHMENT CODES HERE
PDF ATTACHMENT CODES HERE
PDF ATTACHMENT CODES HERE
--02f05ee7d40220f0ebab50ef7440ca55--