注册后无法收到电子邮件

时间:2016-07-03 16:34:41

标签: php mysql

我正在学习php和mysql,我开始了一个小家庭项目,以便更好地学习,为什么不呢?

所以我建立了一个注册页面,可以很好地获取所有信息,但是它无法发送电子邮件来验证帐户。

以下是发送电子邮件的代码:

//other code that is fine
$subject = "Signup | Verification";
$headers = "From: theemail@email.com \r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";

$message = '<html><body>';
$message.='<div style="width:550px; background-color:#CC6600; padding:15px; font-weight:bold;">';
$message.='Email Verification mail';
$message.='</div>';
$message.='<div style="font-family: Arial;">Confiramtion mail have been sent to your email id<br/>';
$message.='click on the below link in your verification mail id to verify your account ';
$message.="<a href='http://192.168.1.106/register/user-confirmation.php?username=$username&email=$email&confirmation_code=$rand'>click</a>";
$message.='</div>';
$message.='</body></html>';

mail($email,$subject,$message,$headers);
//other code that is fine

我在使用网桥的虚拟机中使用LAMP,这就是验证链接中存在IP地址的原因。

1 个答案:

答案 0 :(得分:0)

很可能是因为您没有在本地环境中设置邮件服务器。这是与postfix有关的一些解决方法。

这可能会对你有所帮助。

https://askubuntu.com/questions/47609/how-to-have-my-php-send-mail

相关问题