0

我正在使用 php 中的 mail() 函数发送带有此 html 内容的 html 邮件:

<a href="http://localhost/#/confirm?key=$confirmationLink">
http://localhost/#/confirm?key=$confirmationLink</a>

在hotmail中的href输出如下: http://localhost/#/confirm%3fkey%3df327e518193e515f7c8226a006d0bc5934 ,当我点击链接时不起作用。

它在 gmail 中运行良好,其输出 href 为: http://localhost/#/confirm?key=ee9b70ca92c47210525743a4e7ab112535

如何让它在 Hotmail 中工作?

这就是我使用 mail() 函数的方式:

$to = 'blbl@blblb.dk';
$from = 'contact@bla.dk';
$subject = 'blabla';
$message = <<<EOD
<html>
<body>      
<pre>
To get started please verify your account by clicking this link: 
<a href="http://localhost/#/confirm?key=$confirmationLink">http://localhost/#/confirm?key=$confirmationLink</a>

</pre>
</body>
</html>
EOD;
$headers = "From: $from\r\n";
$headers .= "Content-type: text/html\r\n";
$mail = mail($to, $subject, $message, $headers);
4

1 回答 1

1

显然,Hotmail 对 url 进行了编码,因此当用户返回您的站点时,您需要对 url 进行解码。我认为您调用 AJAX 脚本(由于 url 中的哈希)并将参数发送到服务器端脚本 - 如果是这样,则使用 JavaScript 的 decodeURI 函数,然后才发送 url 参数。无论如何,答案是:您需要解码 url。

于 2011-12-07T01:01:09.817 回答