A
A
Artur Kosikov2020-06-05 17:11:44
gmail
Artur Kosikov, 2020-06-05 17:11:44

Why does gmail put emails sent via yii\swiftmailer\Mailer in the Spam folder?

In config:

'mailer' => [
            'class' => 'yii\swiftmailer\Mailer',
            'useFileTransport' => false,
                'transport' => [
                    'class' => 'Swift_SmtpTransport',
                    'host' => 'mail.site.online',
                    'username' => '[email protected]',
                    'password' => 'passwd_here',
                    'port' => '587',
                    'encryption' => 'tls',
                    'streamOptions' => [
                        'ssl' => [
                            'verify_peer' => false,
                            'verify_peer_name' => false,
                        ],
                    ],
                ],
            ],


Sending a message:

$mail_template = 'email_ru';
 Yii::$app->mailer->compose($mail_template, ['param' => 'value'])
             ->setFrom('[email protected]')
             ->setReplyTo('[email protected]')
             ->setTo('[email protected]')
             ->setSubject(Yii::t('app','Регистрация на сайте Site.online'))
             ->send();


On Yandex and Mail.ru, mail comes to the "Inbox", on Gmail - to the Spam folder ... I

suspect that you need to "dig" in the direction of the SPF, DKIM, DMARC settings?
Didn't encounter...

Answer the question

In order to leave comments, you need to log in

2 answer(s)
Y
Yakov, 2020-06-07
@atillus

First of all, gmail pays attention to the correct SPF record. The combination of HELO + rDNS is also very critical.
In general, it is best to test through https://www.mail-tester.com/ where all the "jambs" will come out. True, he poorly evaluates if rDNS or HELO is not registered and rDNS does not match, for good in these cases it is necessary to give -5

E
Evgeny Bukharev, 2020-06-05
@evgenybuckharev

More precisely, first of all SPF, DKIM, DMARC

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question