При отправке письма на яндекс почту мне выскакивает (при деббагинге) вот такое окно:
2019-11-20 20:20:20 SERVER -> CLIENT: 220 iva8-e1a842234f87.qloud-c.yandex.net ESMTP (Want to use Yandex.Mail for your domain? Visit http://pdd.yandex.ru)<br>
2019-11-20 20:20:20 CLIENT -> SERVER: EHLO localhost<br>
2019-11-20 20:20:20 SERVER -> CLIENT: 250-iva8-e1a842234f87.qloud-c.yandex.net250-8BITMIME250-PIPELINING250-SIZE 42991616250-STARTTLS250-AUTH LOGIN PLAIN XOAUTH2250-DSN250 ENHANCEDSTATUSCODES<br>
2019-11-20 20:20:20 CLIENT -> SERVER: STARTTLS<br>
2019-11-20 20:20:20 SERVER -> CLIENT: 220 Go ahead<br>
2019-11-20 20:20:20 CLIENT -> SERVER: EHLO localhost<br>
2019-11-20 20:20:20 SERVER -> CLIENT: 250-iva8-e1a842234f87.qloud-c.yandex.net250-8BITMIME250-PIPELINING250-SIZE 42991616250-AUTH LOGIN PLAIN XOAUTH2250-DSN250 ENHANCEDSTATUSCODES<br>
2019-11-20 20:20:20 CLIENT -> SERVER: AUTH LOGIN<br>
2019-11-20 20:20:20 SERVER -> CLIENT: 334 VXNlcm5hbWU6<br>
2019-11-20 20:20:20 CLIENT -> SERVER: [credentials hidden]<br>
2019-11-20 20:20:21 SERVER -> CLIENT: 334 UGFzc3dvcmQ6<br>
2019-11-20 20:20:21 CLIENT -> SERVER: [credentials hidden]<br>
2019-11-20 20:20:21 SERVER -> CLIENT: 535 5.7.8 Error: authentication failed: Your message looks like spam. You need to use web for sending or prove you are not a robot using the following link http://ya.cc/6lIV<br>
2019-11-20 20:20:21 SMTP ERROR: Password command failed: 535 5.7.8 Error: authentication failed: Your message looks like spam. You need to use web for sending or prove you are not a robot using the following link http://ya.cc/6lIV<br>
SMTP Error: Could not authenticate.<br>
2019-11-20 20:20:21 CLIENT -> SERVER: QUIT<br>
2019-11-20 20:20:21 SERVER -> CLIENT: 221 2.0.0 Closing connection.<br>
SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting<br>
Использую вот такие настройки:
use PHPMailer\PHPMailer\Exception;
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
require_once __DIR__ . '/PHPMailer/src/Exception.php';
require_once __DIR__ . '/PHPMailer/src/PHPMailer.php';
require_once __DIR__ . '/PHPMailer/src/SMTP.php';
class ContactMailer
{
private static $emailFrom = '';
private static $emailTo = '';
public static function send($name, $phone, $message, $source)
{
$body = "";
$mailer = new PHPMailer();
$mailer->SMTPDebug = 2;
$mailer->isSMTP();
$mailer->Host = 'smtp.yandex.ru';
$mailer->SMTPAuth = true;
$mailer->Username = self::$emailFrom;
$mailer->Password = 'Пароль';
$mailer->SMTPSecure = 'ssl';
$mailer->Port = '465';
$mailer->CharSet = 'UTF-8';
$mailer->setFrom(self::$emailFrom, 'Заголовок');
$mailer->addAddress(self::$emailTo);
$mailer->isHTML(false);
$mailer->Subject = 'Тема';
$mailer->Body = $body;
$mailer->isHTML(true);
if ($mailer->send()) {
return true;
}
return false;
}
}
Отмечу, что на других почтовых сервисах такой проблемы нету
И еще такой момент, ругается только на те яндекс аккаунты, где подтверждена почта