Click here to Skip to main content
14,971,296 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Good day, i am trying an email from the password reset script, the database is fine as the email and the token and the expiry date get recorded in the database however the email does not arrive even in the spam folder it is not there . the error message is showing me that phpmailer folder could not be reached but i am not using phpmailer as i am using mail(): function. can anyone help me on where the problem might be . thanks
    //sending link to the email of the user 
$to = '$users email';
$subject = 'Password reset';
$from = 'example@example.com';
 
// To send HTML mail, the Content-type header must be set
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
 
// Create email headers
$headers .= 'From: '.$from."\r\n".
    'Reply-To: '.$from."\r\n" .
    'X-Mailer: PHP/' . phpversion();
 
// Compose a simple HTML email message
$message = '<html><body>';
$message .= '<p>Dear user <br> We received a password reset request for your account</p>';
$message .= '<p>Please click on the link to reset your password and pleease remember that after a certain period of time, the link will expire. <br> If you did not make this password reset request please ignore this email and your password will not be changed </p>';
$message .= '</body></html>';
 
// Sending email
if(mail($to, $subject, $message, $headers)){
    echo 'Your mail has been sent successfully.';
} else{
    echo 'Unable to send email. Please try again.';
}
  }


What I have tried:

research and code alteration
youtube tutorials
Posted
Updated 22-Jan-21 20:43pm

1 solution

Christ PHP is ugly as hell.

Have you done this?

PHP Mail Configuration[^]
   
Comments
gavin_daCEO 23-Jan-21 2:47am
   
no i did not do it
gavin_daCEO 23-Jan-21 2:49am
   
i got it off the internet so i am still learning
Christian Graus 23-Jan-21 3:08am
   
Yeah, so you should find a beginner course and do it. You would be wise to not do PHP, which is sh*t
gavin_daCEO 23-Jan-21 3:13am
   
i actually had a developer who was helping me with the project but then he dropped me since at that time i knew nothing about programming , i just had to learn. this one is just for demonstration purpose for the client. the real site i will find a developer who specializes with jsp . Thanks but i am also learning jsp. PHP is crap
Christian Graus 23-Jan-21 3:23am
   
I get how a need for work gets you writing a client demo when you can't code. Do what you need to, to make a living, but take the time to learn programming so you end up able to have a career
gavin_daCEO 23-Jan-21 7:13am
   
i will do that. God bless

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900