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:

$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";
$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>";
    $myobj=array('status'=>'success','message'=>'Check your mail to reset password!!');
    echo json_encode($myobj);
    $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 Jul 31 '19 at 4:43
  • Perhaps 000webhost don't provide one!! – Vipul Tyagi Jul 31 '19 at 4:44

I tried you code and it worked. (I edited the first line to be a fixed email address)

Turn on sendmail in the control panel (if it's off)

  • Website settings
    • General
      • Sendmail

Be aware that the free account is limited to 50 emails per day.

| improve this answer | |
  • When I tried it for first time, it actually sent mail for once. But now it is not working!! – Vipul Tyagi Jul 31 '19 at 7:00
  • sometimes free services are worth less than what you paid, regrettably that may include this answer also. – Jasen Jul 31 '19 at 9:21
  • Yes, it sends mail after 2-3 hours! – Vipul Tyagi Jul 31 '19 at 13:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.