激活密码passwordkey php(MySql)

时间:2014-04-28 22:29:10

标签: php mysql

我有一个工作正常的登录系统,Iget带有激活链接的邮件,但我想我应该改变一些。以前有人见过这个:

$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);

在邮件中我得到了这个:

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

任何提示?

1 个答案:

答案 0 :(得分:1)

如果您想在两封邮件之间换行,可以使用以下内容:

$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);

或带有可点击文字链接的HTML:

$subject = "Confirmation link to your e-mail: $username";
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=utf-8" . "\r\n";

$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);

旁注: (适用于HTML版本)

$message = "<a href=\"的转义双引号$message = "<a href='或单引号href非常重要。否则,密码的变量将不会显示。