【发布时间】:2016-09-03 01:07:10
【问题描述】:
我正在尝试发送一些带有 php mail() 链接的文本作为纯文本。链接看起来像这样https://example.com?en=1509 但是在我收到的邮件中,链接看起来像这样https://example.com?en09。如果我单独发送一个 '=' 没问题,但如果我有一个相等和一个数字,它就不再工作了。
这是我用来发送邮件的代码:
$header[] = 'MIME-Version: 1.0';
$header[] = 'Content-Type: text/plain; charset=UTF-8';
$header[] = 'Content-Transfer-Encoding: quoted-printable';
$header[] = $from;
mail($mail,$titel, $text, implode("\r\n",$header));
有人可以帮我解决这个问题吗?
[编辑]
如果我查看 Thunderbird 邮件源代码,一切正常,但显示错误。
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
From: admin <admin@example.com>
Message-Id: <20160514213835.DD631480051D@example.com>
Date: Sat, 14 May 2016 23:38:35 +0200 (CEST)
https://example.com?en=1545
我还尝试将链接作为 text/html 发送并将其包装到适当的标签中,但没有任何效果。链接总是断开。
谢谢
【问题讨论】:
-
尝试添加标题 $headers .= 'Content-type: text/html;字符集=utf-8' 。 "\r\n";而不是 'Content-Type: text/plain; charset=UTF-8';
-
对不起,我应该提到我已经尝试过了。这没有帮助。它也不是提到的两个问题的重复,因为我不想发送 href 链接,我想发送纯链接。
-
显示您在电子邮件中发送的内容
-
如您在上面看到的,我使用该链接发送了一封测试邮件。不幸的是,它不是雷鸟。在我的手机上,链接也坏了。我可以通过添加 ?en=R1545 来欺骗 Thunderbird 显示正确的链接,但这在我的手机上不起作用...