G
G
Genri_Rus2019-11-20 23:27:09
PHP
Genri_Rus, 2019-11-20 23:27:09

How to remove this problem when sending emails?

When sending a letter to Yandex, the mail pops up for me (during debugging) this window:

2019-11-20 20:20:20 SERVER -&gt; 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 -&gt; SERVER: EHLO localhost<br>
2019-11-20 20:20:20 SERVER -&gt; 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 -&gt; SERVER: STARTTLS<br>
2019-11-20 20:20:20 SERVER -&gt; CLIENT: 220 Go ahead<br>
2019-11-20 20:20:20 CLIENT -&gt; SERVER: EHLO localhost<br>
2019-11-20 20:20:20 SERVER -&gt; 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 -&gt; SERVER: AUTH LOGIN<br>
2019-11-20 20:20:20 SERVER -&gt; CLIENT: 334 VXNlcm5hbWU6<br>
2019-11-20 20:20:20 CLIENT -&gt; SERVER: [credentials hidden]<br>
2019-11-20 20:20:21 SERVER -&gt; CLIENT: 334 UGFzc3dvcmQ6<br>
2019-11-20 20:20:21 CLIENT -&gt; SERVER: [credentials hidden]<br>
2019-11-20 20:20:21 SERVER -&gt; 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 -&gt; SERVER: QUIT<br>
2019-11-20 20:20:21 SERVER -&gt; CLIENT: 221 2.0.0 Closing connection.<br>
SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting<br>

I use these settings:
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;
    }
}

I note that there is no such problem on other mail services.
And there is such a moment, it only swears at those Yandex accounts where the mail is confirmed

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladislav Lyskov, 2019-11-20
@Vlatqa

You send mail to Yandex mailboxes for a domain that no longer exists

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question