PHP 发送的电子邮件中损坏的 link
Broken link within an email sent with PHP
我 运行 遇到了一个奇怪的问题,试图使用 php 通过电子邮件发送 link。 link 只会将用户带到 "Update Password" 表单。但是,当我单击 link 时,它会将我带到浏览器中名为 "about:blank" 的空白页面。我真的不明白为什么会这样……这是我的代码: link 的 html 在 $msg 变量中。
$to = $email;
$msg = "Hello $username, your pin # is $pin. Please remember this pin
because you will need it on the update password form. <br>
Please <a href = \"google.com\">click here</a> to be brought to the update password form.";
$header = 'MIME-Version: 1.0' . "\r\n";
$header .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$header .= 'From: ForgottenPassword@PHPGang.com' . "\r\n" .
'Reply-To: ForgottenPassword@PHPGang.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to,"Forgotten Password",$msg,$header);
我什至尝试将 google.com 作为目的地,但它仍然将我带到那个讨厌的 about:blank 页面。有什么想法吗?
您需要在 link.
中使用完全限定的 URL、协议和所有内容
$msg = "Hello $username, your pin # is $pin. Please remember this pin
because you will need it on the update password form. <br>
Please <a href = \"http://google.com\">click here</a> to be brought to the update password form.";
尝试如下更改,此处缺少将 http 添加到 url、
<a href = \"google.com\">click here</a>
至
<a href = \"http://google.com\">click here</a>
我 运行 遇到了一个奇怪的问题,试图使用 php 通过电子邮件发送 link。 link 只会将用户带到 "Update Password" 表单。但是,当我单击 link 时,它会将我带到浏览器中名为 "about:blank" 的空白页面。我真的不明白为什么会这样……这是我的代码: link 的 html 在 $msg 变量中。
$to = $email;
$msg = "Hello $username, your pin # is $pin. Please remember this pin
because you will need it on the update password form. <br>
Please <a href = \"google.com\">click here</a> to be brought to the update password form.";
$header = 'MIME-Version: 1.0' . "\r\n";
$header .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$header .= 'From: ForgottenPassword@PHPGang.com' . "\r\n" .
'Reply-To: ForgottenPassword@PHPGang.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to,"Forgotten Password",$msg,$header);
我什至尝试将 google.com 作为目的地,但它仍然将我带到那个讨厌的 about:blank 页面。有什么想法吗?
您需要在 link.
中使用完全限定的 URL、协议和所有内容$msg = "Hello $username, your pin # is $pin. Please remember this pin
because you will need it on the update password form. <br>
Please <a href = \"http://google.com\">click here</a> to be brought to the update password form.";
尝试如下更改,此处缺少将 http 添加到 url、
<a href = \"google.com\">click here</a>
至
<a href = \"http://google.com\">click here</a>