I am trying to send an email to myself but I am getting this error enter image description here
The code that I use is
function notify_password($username, $password) {
// notify the user that their password has been changed
$conn = db_connect();
$result = $conn->query("select email from user
where username='".$username."'");
if (!$result) {
throw new Exception('Could not find email address.');
} else if ($result->num_rows == 0) {
throw new Exception('Could not find email address.');
// username not in db
} else {
$row = $result->fetch_object();
$email = $row->email;
$from = "From: [email protected] rn";
$mesg = "Your password has been changed to ".$password."rn"
."Please change it next time you log in.rn";
if (mail($email, 'login information', $mesg, $from)) {
return true;
} else {
throw new Exception('Could not send email.');
}
}
}
I have setup my php.ini file like this phpinifile
and my sendmail file like this sendmailfile
New contributor
Dimitris Lisg is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.