D
D
Daniil Sidorov2018-04-23 17:28:36
SMTP
Daniil Sidorov, 2018-04-23 17:28:36

Why is Yii2 swiftmailer not working?

Hello, I am making a website in yii2 (basic). Made mail for a domain on Yandex. Writes that the domain is connected.
Next, in the config/web.php file, I added the following:

'mailer' => [
            'class' => 'yii\swiftmailer\Mailer',
            'viewPath' => '@app/mail',
            'transport' => [
                'class' => 'Swift_SmtpTransport',
                'host' => 'ssl://smtp.yandex.ru',
                'username' => '[email protected]',
                'password' => 'moiparol',
                'port' => 465,
            ],
            'useFileTransport' => false,
        ],

Then I try to send a simple email:
Yii::$app->mailer->compose()
            ->setFrom('[email protected]')
            ->setTo('[email protected]')
            ->setSubject('Тема письма')
            ->setTextBody('Текст')
            ->send();

And I get an error:
Connection could not be established with host ssl://smtp.yandex.ru [ #0]

Help me to understand.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Daniil Sidorov, 2018-04-23
@DaniLaFokc

Disabling the antivirus solved the problem

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question