[img]https://i.sstatic. net/ZLDSkp7m.png[/img]
Код, который я использую:
Код: Выделить всё
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: di@gmail.com \r\n";
$mesg = "Your password has been changed to ".$password."\r\n"
."Please change it next time you log in.\r\n";
if (mail($email, 'login information', $mesg, $from)) {
return true;
} else {
throw new Exception('Could not send email.');
}
}
}
[img]https://i.sstatic. net/JhB4Vy2C.png[/img]
и мой файл sendmail вот так
[img]https:// i.sstatic.net/Um0aOfwE.png[/img]
Подробнее здесь: https://stackoverflow.com/questions/785 ... -with-smtp
Мобильная версия