从 2 个不同服务器发送邮件时出现主题(和正文)电子邮件编码问题
我已经切换了发送电子邮件的编码,并使用本文中的相关补丁:
它在我们的一台服务器上运行良好,(在 Outlook 和 gmail 中)
To: [email protected]
Subject: =?UTF-8?B?U3VqZXQgYXZlYyBkw6lzIGFjY8Oow6jDqMOow6jDqMOobnRzIOKCrCAhIQ==?=
Date: Wed, 31 Aug 2011 16:37:38 +0200
主题和正文都可以。
但是在第二台服务器上,有一个奇怪的行为,我收到了该主题的电子邮件标头:
To: [email protected]
Subject: =?US-ASCII?B?PT9VVEYtOD9CP1UzVnFaWFFnWVhabFl5?=
=?US-ASCII?B?Qmt3Nmx6SUdGalk4T293NmpEcU1Pb3c2akRxTU9vYm5SeklPS0NyQ0FoSVE9?=
=?US-ASCII?B?PT89?=
似乎主题被重新编码并强制为 US-ASCII,它导致主题不可读并且 UTF8 字符丢失身体。
两台服务器上使用相同的测试脚本和电子邮件类。
知道这个错误可能来自哪里吗?
I have switched the encoding of sent emails, with the patch related in this post:
It works great from one of our server, (in Outlook and gmail)
To: [email protected]
Subject: =?UTF-8?B?U3VqZXQgYXZlYyBkw6lzIGFjY8Oow6jDqMOow6jDqMOobnRzIOKCrCAhIQ==?=
Date: Wed, 31 Aug 2011 16:37:38 +0200
The subject and body are OK.
But on the second server, there is a weird behaviour, I get this email header for the subject:
To: [email protected]
Subject: =?US-ASCII?B?PT9VVEYtOD9CP1UzVnFaWFFnWVhabFl5?=
=?US-ASCII?B?Qmt3Nmx6SUdGalk4T293NmpEcU1Pb3c2akRxTU9vYm5SeklPS0NyQ0FoSVE9?=
=?US-ASCII?B?PT89?=
It seems that the subject is re-encoded and forced to US-ASCII, it leads to an unreadable subject and the UTF8 characters are lost in the body.
The same test script and email class is used on both servers.
Any idea where this bug could comes from ?
该错误是由 mbstring.func_overload 值引起的。它从 7 更改为 6,现在它按预期工作。感谢您的帮助。
The bug was due to the mbstring.func_overload value. It was changed from 7 to 6 and now it works as expected. Thanks for your help.