doujie7886 2015-08-24 19:52
浏览 25
已采纳

使用PHP发送的电子邮件中的链接断开

I have run into a strange problem trying to send a link with an email using php. This link will simply bring a user to an "Update Password" form. However, when I click the link it brings me to a blank page in my browser called "about:blank". I don't really understand why this is happening... Here is my code: The html for the link is inside the $msg variable.

$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' . "
";
$header .= 'Content-type: text/html; charset=iso-8859-1' . "
";
$header .= 'From: ForgottenPassword@PHPGang.com' . "
" .
                'Reply-To: ForgottenPassword@PHPGang.com' . "
" .
                'X-Mailer: PHP/' . phpversion();    

mail($to,"Forgotten Password",$msg,$header);

I even tried putting google.com as the destination, but it still brings me to that pesky about:blank page. Any ideas?

  • 写回答

2条回答 默认 最新

  • dspx15491 2015-08-24 19:54
    关注

    You need to use a fully qualified URL, protocol and all, in your link.

    $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.";
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥88 实在没有想法,需要个思路
  • ¥15 MATLAB报错输入参数太多
  • ¥15 python中合并修改日期相同的CSV文件并按照修改日期的名字命名文件
  • ¥15 有赏,i卡绘世画不出
  • ¥15 如何用stata画出文献中常见的安慰剂检验图
  • ¥15 c语言链表结构体数据插入
  • ¥40 使用MATLAB解答线性代数问题
  • ¥15 COCOS的问题COCOS的问题
  • ¥15 FPGA-SRIO初始化失败
  • ¥15 MapReduce实现倒排索引失败