L
L
Leopandro2015-12-04 19:21:54
Yii
Leopandro, 2015-12-04 19:21:54

Why are yii2 messages not being sent?

Here is the code in the model:

$user->generateSecretKey();
            if($user->save())
            {
                return Yii::$app->mailer->compose('resetPassword', ['user' => $user])
                    ->setFrom([Yii::$app->params['supportEmail'] => Yii::$app->name . ' (отправлено роботом)'])
                    ->setTo($this->email)
                    ->setSubject('Сброс пароля для ' . Yii::$app->name)
                    ->send();
            }

Config:
'mailer' => [
            'class' => 'yii\swiftmailer\Mailer',
            // send all mails to a file by default. You have to set
            // 'useFileTransport' to false and configure a transport
            // for the mailer to send real emails.
            'useFileTransport' => false,
        ],

Tried changing 'useFileTransport' to true, but didn't help. In the logs, the message, that is, does not come to the mail.
A quick note: swiftMailer is underlined in red for some reason...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2015-12-04
@frost18

It seems to me that this is a server problem, the message was sent by the framework, look for the problem in the next link. PS Have you looked at spam?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question