P
P
photosho2021-10-04 17:26:33
PHPMailer
photosho, 2021-10-04 17:26:33

Why is mail not sent to Yandex (PHP Mailer)?

I'm trying to send an email using Yandex SMTP using PHP Mailer. Registered mail, set the application password, entered the mail (activated it). PHP Mailer setup code:

$mail = new PHPMailer();
$mail->CharSet = 'UTF-8';

$mail->Mailer = 'smtp';
$mail->Host = 'smtp.yandex.ru';
$mail->Port = 465;
$mail->isSMTP();
$mail->SMTPAuth = true;
$mail->Username = EMAIL;
$mail->Password = ПАРОЛЬ ПРИЛОЖЕНИЯ;


$mail->SMTPSecure = 'ssl';

$mail->SMTPOptions = [
  'ssl' => [
    'verify_peer' => false,
    'verify_peer_name' => false,
    'allow_self_signed' => true

  ]
];

...

$mail->send();

As a result, this error:

> SMTP Error: Could not authenticate.

The email address and password of the application are correct. Neither SSL nor TLS work. Tell me which direction to look for.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Karabanov, 2021-10-04
@karabanov

An application password is not required. Use the user's e-mail and password.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question