Answer the question
In order to leave comments, you need to log in
Why doesn't swiftmailer send via mail() in YII2?
Hello!
There was a problem sending emails in yii2.
The configuration is:
Yii 2.0.14.1.
swiftmailer 6.0.2.
PHP 7.1.
When sending on local, error prntscr.com/ink2wj
When sending on the server, the send function returns false. There are no errors in the logs.
I send an email like this:
$mail = Yii::$app->mailer->compose()
->setFrom('тут email')
->setTo('тут email')
->setSubject('Тема сообщения')
->setTextBody('Текст сообщения')
->setHtmlBody('<b>текст сообщения в формате HTML</b>')
->send();
'mailer' => [
'class' => 'yii\swiftmailer\Mailer',
],
Answer the question
In order to leave comments, you need to log in
Good afternoon.
Look in the runtime/mail directory if 'useFileTransport' => true.
For sending mail to work, you need to configure swiftmailer Something
like this:
'transport' => [
'class' => 'Swift_SmtpTransport',
'host' => // mail host,
'port' => // port,
'username' => // login mail,
'password' => // pass mail,
//'encryption' => 'ssl'
]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question