简体   繁体   中英

Html link is not working in Hotmail

I am using the mail() function in php to send a html mail with this html content:

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

The href outputs like this in hotmail: http://localhost/#/confirm%3fkey%3df327e518193e515f7c8226a006d0bc5934 and does not work when I click the link.

It works fine in gmail, which outputs href as: http://localhost/#/confirm?key=ee9b70ca92c47210525743a4e7ab112535

How to make it work in Hotmail?

This is how I use the mail() function:

$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);

Apparently Hotmail encodes the url so you need to decode the url when a user gets back to you site. I think you call an AJAX script (cause of the hash in the url) and send the parameters to the server-side script - if so then use JavaScript's decodeURI function and only then send the url parameters. Anyway the answer is: You need to decode the url.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM