Reputation: 315
I have this error: "The view file does not exist: /var/www/html/myproject/frontend/views/common/mail/passwordResetToken-html.php"
This is the code located at frontend/models/PasswordResetRequestForm
return Yii::$app
->mailer
->compose(
['html' => '/common/mail/passwordResetToken-html',
'text' => '/common/mail/passwordResetToken-text'],
['user' => $user]
)
->setFrom([Yii::$app->params['supportEmail'] => Yii::$app->name . ' robot'])
->setTo($this->email)
->setSubject('Password reset for ' . Yii::$app->name)
->send();
Upvotes: 1
Views: 814
Reputation: 133380
Could be you have the wrong path for common mail try
return Yii::$app
->mailer
->compose(
['html' => '@common/mail/passwordResetToken-html',
'text' => '@common/mail/passwordResetToken-text'],
['user' => $user]
)
->setFrom([Yii::$app->params['supportEmail'] => Yii::$app->name . ' robot'])
->setTo($this->email)
->setSubject('Password reset for ' . Yii::$app->name)
->send();
And over all check if your main.php or main-local you have
'components' => [
.....
'mailer' => [
'class' => 'yii\swiftmailer\Mailer',
'viewPath' => '@common/mail', // <<<<----------- this entry
....
......
'transport' => [
....
],
],
],
Upvotes: 2