【发布时间】:2012-04-15 14:53:36
【问题描述】:
我有一个发送电子邮件的脚本,看起来像这样:
$headers = "From: test@example.com\r\n";
$headers .= "Reply-To: test@example.com\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/plain; charset=utf-8\r\n";
$headers .= "Content-Transfer-Encoding: 8bit";
$orgsubject = "A subject with some swedish characters like å, ä and ö";
$newsubject='=?UTF-8?B?'.base64_encode($orgsubject).'?=';
$body = 'A lot of text.
Some more text.
A long URL:
http://example.com/subpage/?id=1234&hash=23jh4lk2j3h4lkjh674598xzxlk2j34h&anotherhash=h2k3j4h23kh42kj34h2lk3';
已经过彻底测试,但某些用户(我认为是 Outlook 用户)会得到如下所示的 URL: http://example.com/subpage/?id=3D1234&hash=3D3D23jh4lk2j3h4lkjh674598xzxlk2j34h&anotherhash=3Dh2k3j4h23kh42kj34h2lk3 现在等号后面是“3D”,这在我的情况下使 URL 无用。我想这与 Content-Transfer-Encoding 或 Content-type 有关,我需要将正文消息编码为 base64 吗?
更新
刚找到这个论坛帖子:https://stackoverflow.com/a/7289434/513321 所以我删除了 Content-Transfer-Encoding ,它似乎工作正常,但另一方面,我永远无法重现 URL 包含“3D”文本的错误,所以我不能确定这是否有效。有谁知道删除 Content-Transfer-Encoding 是否可以解决我的问题?
【问题讨论】:
标签: content-type php