【问题标题】:Html link is not working in HotmailHtml 链接在 Hotmail 中不起作用
【发布时间】:2011-12-07 00:43:21
【问题描述】:

我正在使用 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);

【问题讨论】:

    标签: php email hotmail


    【解决方案1】:

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

    【讨论】:

    • decodeURI 不起作用,但感谢您引导我走上正确的道路。 javascript 命令:unescape(url) 起作用了。
    猜你喜欢
    • 2012-01-08
    • 2012-05-26
    • 1970-01-01
    • 2015-07-29
    • 1970-01-01
    • 1970-01-01
    • 2015-02-24
    • 2018-08-21
    • 2013-12-16
    相关资源
    最近更新 更多