gpt4 book ai didi

php - 注册后收不到邮件

转载 作者:行者123 更新时间:2023-11-29 20:49:38 25 4
gpt4 key购买 nike

我正在学习 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 地址的原因。

最佳答案

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

这里有一些可能对您有帮助的内容。

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

关于php - 注册后收不到邮件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38172027/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com