我一直在寻找解决方案,但找不到任何人。在显示代码之前,我想告诉您的是。我使用了Gmail电子邮件来接收来自无法正常工作的电子邮件,甚至在域中仍然无法正常工作的情况下创建了电子邮件。即使邮件正在发送,代码也能正常工作,但我无法收到它。
if(isset($_POST['forget'])) {
$myemail = "admin@study-material.info";
$email = $_POST['email'];
$password = $_POST['password'];
include("../functions/backend.php");
$obj = new Crud;
$uemail = $obj->forget($email);
if(mysqli_num_rows($uemail) > 0){
foreach($uemail as $show){
$chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()_-=+;:,.?";
$password = substr( str_shuffle( $chars ), 0, 8 );
$obj->updatepassword($password,$show['Email']);
$to = $show['Email'];
$subject = "Your Recovered Password";
$message = "Please use this password to login <br> password: " . $password. "<br>Email: " . $show['Email'];
$headers = "From: $myemail";
if(mail($to, $subject, $message, $headers)){
echo "Your Password has been sent to your ".$show['Email']."";
}else{
echo "Failed to Recover your password, try again";
}
}
}
else
{
echo "<script>alert('Email you intered not registered.');</script>";
}
}