How do I setup the reset password function on Yii2? -
i have error: "the view file not exist: /var/www/html/myproject/frontend/views/common/mail/passwordresettoken-html.php"
this code located @ 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 ' . yii::$app->name) ->send();
could have wrong path 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 ' . yii::$app->name) ->send();
and on check if main.php or main-local have
'components' => [ ..... 'mailer' => [ 'class' => 'yii\swiftmailer\mailer', 'viewpath' => '@common/mail', // <<<<----------- entry .... ...... 'transport' => [ .... ], ], ],
Comments
Post a Comment