我有一封电子邮件,是phpmailer用明文发送的。
当这封电子邮件通过php mail()发送时,我收到了确切的电子邮件。当通过小型企业服务器上的Exchange发送电子邮件时,它似乎会在某些点插入unicode字符。由电子邮件程序接收的示例源代码:
php邮件:
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain; charset="utf-8"
Dear J,
This is confirmation of your registration.
Event: Green City Dialogues: Toward a sustainable built environment in Christchurch (2): Green City Dialogues 2
Date: Monday, 19 September 2011 05:15 pm - 08:00 pm
Attendee: J DExchange服务器:
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset="utf-8"
X-TM-AS-Product-Ver: SMEX-10.1.0.1137-6.500.1024-18326.006
X-TM-AS-Result: No--12.011100-0.000000-31
X-TM-AS-User-Approved-Sender: Yes
X-TM-AS-User-Blocked-Sender: No
X-DSPAM-Check: by xxx.xxx.xxx on Wed, 17 Aug 2011 11:59:06 +1200
X-DSPAM-Result: Innocent
X-DSPAM-Processed: Wed Aug 17 11:59:06 2011
X-DSPAM-Confidence: 0.5596
X-DSPAM-Probability: 0.0000
Dear xxxxx,
This is confirmation of your registration.
Event:=A0Green City Dialogues: Toward a sustainable built environment in Ch=
ristchurch (2): Green City Dialogues 2
Date: Monday, 19 September 2011 05:15 pm - 08:00 pm发布于 2011-10-07 17:29:55
事实证明,通过Unix服务器发送的明文电子邮件也包含a0字符,即使在源代码视图中,它也会被Gmail过滤掉。
问题是
Html_entity_decode($result‘’introtext‘)
修复方法
Html_entity_decode($result‘’introtext‘,ENT_COMPAT,'UTF-8')
发布于 2011-08-17 16:57:26
UTF-8中的U代表Unicode。由于您在代码中使用了以下代码:
Content-Transfer-Encoding: 8bit
Content-Type: text/plain; charset="utf-8"..。您已经在发送Unicode字符。
我知道你实际上指的是这个:=A0。根据headers:
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset="utf-8..。它是Unicode字符的纯ASCII表示。这很好: Exchange只是修复您的电子邮件,以便它可以成功地通过无法处理8位消息的电子邮件系统。实际上,如果你想实现最大的兼容性,你应该使用do it yourself。在任何情况下,消息内容都保持不变。这只是一个临时的编码来传输它。
发布于 2011-08-17 17:11:47
内容传输编码:8位
SMTP (通常)不支持8位数据。
我对phpmailer()不是很熟悉--但是我很惊讶它会创建一个8位的电子邮件。
MS-Exchange可能不是我最喜欢的MTA,但在这种情况下,它似乎正确地清理了您的电子邮件。
AFAIK没有名为"php mail“的MTA -所以我不确定您实际上是在将MS-Exchange处理的电子邮件与之进行比较。
https://stackoverflow.com/questions/7090114
复制相似问题