Answer the question
In order to leave comments, you need to log in
PHPMailer does not send mail to yandex, what's wrong?
PHPMailer does not send mail via SMTP yandex, the debugger gives the following:
could not authenticate.
$username = '***********@yandex.ru';
$password = '******';
$host = 'smtp.yandex.ru'; // Пробовал 'ssl://smtp.yandex.ru'
$mail->SMTPDebug = SMTP::DEBUG_SERVER;
$mail->isSMTP();
$mail->Host = $host;
$mail->SMTPAuth = true;
$mail->Username = $username;
$mail->Password = $password;
$mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS;
$mail->Port = 465;
$mail->CharSet = 'UTF-8';
$mail->setFrom($username, '*****');
$mail->addAddress($user_email); // $user_email = '******@yandex.ru'
$mail->isHTML(true);
$mail->Subject = 'Тест';
$mail->Body = '<b>123</b>';
$mail->AltBody = 'Тестовое сообщение.';
$mail->send();
Answer the question
In order to leave comments, you need to log in
In general, who cares, the problem eventually turned out to be in the hosting, they tested it on another one and it all worked. Unfortunately, the owner of the old hosting did not want to make changes.
If you run into a similar problem and you're sure your code is correct, check with OpenSSL, it will show you exactly what the problem is. In my case, the problem is with certificates.
Try to enable imap in your mail settings (for greater certainty, you can check the box for POP3) Yasha also
has passwords for applications, you can try to log in using the generated application password.
And you can also try to replace ENCRYPTION_SMTPS with ENCRYPTION_STARTTLS and port from 465 to 587
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question