0
I have made a small php project on 000webhost. The system sends mail to the user if he/she forgets password to reset it. But the problem is that it can't send mail at all. Here is my php code:
<?php
$tomail=$_POST["usermail"];
$subject="Password Reset";
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'To: '.$tomail."\r\n";
$link="https://dhankosh-in.000webhostapp.com/reset_password.php";
$message="<html><head></head><body><p>Click on the link below to reset your password</p><br><br><a href='".$link."'>Click here to reset your password</a></body></html>";
if(mail($tomail,$subject,$message,$headers))
{
$myobj=array('status'=>'success','message'=>'Check your mail to reset password!!');
echo json_encode($myobj);
}
else{
$myobj=array('status'=>'error','message'=>'Invalid e-mail!!');
echo json_encode($myobj);
}
?>
It sends the response as 'Check your mail to reset password!!' but I don't receive any mail. Trying it for so many hours but with no success!! Please help!!
Can you check mail server log files? – AnFi – 2019-07-31T04:43:54.350
Perhaps 000webhost don't provide one!! – Vipul Tyagi – 2019-07-31T04:44:49.870