douzang7928 2014-04-28 22:29 采纳率: 100%
浏览 28

激活密码passwordkey php(MySql)

I have a loginsystem that works fine, Iget the mail with the activating link, but i think i should change somethin. Have anybody seen this before:

$subject = "Confirmation link to your e-mail: $username";
   $header = "Confirmation link to your e-mailt";
   $message = "press to activate link";
   $message .= "http://wwww.yourname.com/confirm.php?passkey=$com_code";

   $sentmail = mail($to,$subject,$message,$header);

in the mail i got this:

Press link to activate accounthttp://wwww.yourname.com/confirm.php?passkey=e4c4c9e4c43cce28e472243b97085bac

Any tip?

  • 写回答

1条回答 默认 最新

  • dongshai8330 2014-04-28 22:42
    关注

    If you want to have a new line between both message, you can use the following:

    $subject = "Confirmation link to your e-mail: $username";
    $header = "Confirmation link to your e-mailt";
    $message = "press to activate link 
    
    http://wwww.yourname.com/confirm.php?passkey=$com_code";
    
    $sentmail = mail($to,$subject,$message,$header);
    

    or as HTML with a clickable text link:

    $subject = "Confirmation link to your e-mail: $username";
    $headers = "MIME-Version: 1.0" . "
    ";
    $headers .= "Content-type:text/html;charset=utf-8" . "
    ";
    
    $message = "<a href=\"http://wwww.yourname.com/confirm.php?passkey=$com_code\">Press to activate link</a>";
    
    // or use single quotes
    // $message = "<a href='http://wwww.yourname.com/confirm.php?passkey=$com_code'>Press to activate link</a>";
    
    $sentmail = mail($to,$subject,$message,$headers);
    

    Sidenote: (for HTML version)

    The escaped double quote $message = "<a href=\" or single quote $message = "<a href=' for the href are important. Otherwise, the pass code's variable will not show.

    评论

报告相同问题?

悬赏问题

  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 划分vlan后不通了
  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大