2011-12-07 40 views
0
我使用的mail()函數在PHP

工作發送HTML郵件與這個網站的內容:HTML鏈接是不是在Hotmail的

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

的HREF輸出像這樣的Hotmail: http://localhost/#/confirm%3fkey%3df327e518193e515f7c8226a006d0bc5934 並執行當我點擊鏈接時不起作用。

它工作正常在Gmail中,其輸出HREF爲: http://localhost/#/confirm?key=ee9b70ca92c47210525743a4e7ab112535

如何使它在Hotmail的工作?

這是我如何使用電子郵件()函數:

$to = '[email protected]'; 
$from = '[email protected]'; 
$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); 

回答

1

顯然Hotmail的編碼網址,所以你需要當用戶回來給你網站的URL進行解碼。我想你可以調用一個AJAX腳本(引起url中的散列)並將參數發送到服務器端腳本 - 如果是的話,那麼使用JavaScript的decodeURI函數,然後發送url參數。無論如何,答案是:你需要解碼的網址。

+0

我會試試你的指示! – Christian

+0

decodeURI無法正常工作,但感謝您在正確的路徑上引導我。 javascript命令:unescape(url)工作。 – Christian