Answer the question
In order to leave comments, you need to log in
How to specify your own text in the letter instead of the sender?
Now I'm trying to write like this.
'mailer' => [
'class' => 'yii\swiftmailer\Mailer',
'messageConfig' => [
'from' => ['[email protected]' => 'test'],
],
],
Answer the question
In order to leave comments, you need to log in
Good morning.
Try using compose() to do this.
More or less like this:
Yii::$app->mailer->compose('@app/modules/users/mails/passwordReset', ['user' => $user])
->setFrom([Yii::$app->params['supportEmail'] => Yii::$app->name . ' robot'])
->setTo($this->email)
->setSubject('Password reset for ' . Yii::$app->name)
->send();
As far as I understand it should be written like this?
Yii::$app->mailer->compose('@app/modules/users/mails/passwordReset', ['user' => $user])
->setFrom([Yii::$app->params['supportEmail'] => 'sssssssssssssssssssss'])
->setTo($this->email)
->setSubject('Password reset for ' . Yii::$app->name)
->send();
Change the value of the supportEmail key to your own text in the configuration file-params.php.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question