【问题标题】:exchange server inserts unicode characters into plaintext email?交换服务器将 unicode 字符插入纯文本电子邮件?
【发布时间】:2011-10-07 17:29:54
【问题描述】:

我有一封电子邮件,由 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 D

交换服务器:

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

【问题讨论】:

  • 那么,问题是什么?

标签: php email exchange-server


【解决方案1】:

UTF-8 中的 U 代表 Unicode。由于您在代码中使用它:

Content-Transfer-Encoding: 8bit
Content-Type: text/plain; charset="utf-8"

...您已经在发送 Unicode 字符了。

我知道您实际上指的是:=A0。根据标题:

Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset="utf-8

...它是您的 Unicode 字符的纯 ASCII 表示。这很好:Exchange 只是在修复您的电子邮件消息,以便它可以成功地通过无法处理 8 位消息的电子邮件系统。实际上,如果你想实现最大的兼容性,你应该do it yourself。无论如何,消息内容保持不变。这只是传输它的临时编码。

【讨论】:

    【解决方案2】:

    内容传输编码:8bit

    SMTP 不(通常)支持 8 位数据。

    我对 phpmailer() 不太熟悉 - 但我很惊讶它应该创建一个 8 位电子邮件。

    MS-Exchange 可能不是我最喜欢的 MTA,但在这种情况下,它似乎正确地清理了您的电子邮件。

    AFAIK 没有称为“php 邮件”的 MTA - 所以我不确定您实际将 MS-Exchange 处理的电子邮件与什么进行比较。

    【讨论】:

      【解决方案3】:

      事实证明,通过 Unix 服务器的明文电子邮件也包含 a0 字符,并且被 Gmail 过滤掉了,即使在源代码视图中也是如此。

      问题是

      html_entity_decode($result['introtext'])

      修复

      html_entity_decode($result['introtext'],ENT_COMPAT,'UTF-8')

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2011-09-01
        • 2018-07-19
        • 2012-05-05
        • 1970-01-01
        • 2017-06-19
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多