嘿,我已经设置了以下代码,向订阅者发送验证电子邮件。但它似乎没有达到它们(我自己测试)我正在使用http://localhost/测试网站,不知道这是不是问题。此外,我收到验证电子邮件已发送的消息,因此应该发送。这是代码:
if(mysql_query("insert into users(username,password,email,fname,lname,hash) values('$username','$password','$email','$fname','$lname','$hash')")or die (mysql_error ())){
echo "Welcome, You have successfully signed up. Please check the verification e-mail sent to you.";
$to = $email;
$subject = 'Signup | Verification';
$message = '
Thanks for signing up!
Your account has been created, you can login with the following credentials after you have activated your account by pressing the url below.
------------------------
Username: '.$username.'
Password: '.$password.'
------------------------
Please click this link to activate your account:
http://www.JMtoday.com/verify.php?email='.$email.'&hash='.$hash.'
';
$headers = 'From:noreply@JMtoday.com' . "\r\n";
mail($to, $subject, $message, $headers);
}
答案 0 :(得分:2)
除非您在localhost上运行邮件服务器,否则mail
功能将无法知道将电子邮件发送到何处。