2014-04-28 103 views
-1

我有一个工作正常的登录系统,我得到了激活链接的邮件,但我想我应该改变一些事情。曾经有人见过这个:激活密码passwordkey php(MySql)

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

任何提示:

$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); 
在我得到这个邮件

+0

您的代码完全按照代码进行编码;没有空间。要么添加一个,要么插入换行符。 –

+0

我应该改变它吗? – user2879767

+0

即使缺少空格,“mail()”默认情况下会发送纯文本电子邮件,除非您的访客的电子邮件客户端有用地解释链接,否则他们只会看到一段文字。如果你想确定链接,你需要发送一个HTML格式的邮件。 –

回答

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很重要。否则,密码的变量将不会显示。