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条)

报告相同问题?

悬赏问题

  • ¥15 像这种代码要怎么跑起来?
  • ¥15 怎么改成循环输入删除(语言-c语言)
  • ¥15 安卓C读取/dev/fastpipe屏幕像素数据
  • ¥15 pyqt5tools安装失败
  • ¥15 mmdetection
  • ¥15 nginx代理报502的错误
  • ¥100 当AWR1843发送完设置的固定帧后,如何使其再发送第一次的帧
  • ¥15 图示五个参数的模型校正是用什么方法做出来的。如何建立其他模型
  • ¥100 描述一下元器件的基本功能,pcba板的基本原理
  • ¥15 STM32无法向设备写入固件