Answer the question
In order to leave comments, you need to log in
Is it possible to include a php mail send file in Yii2?
There is an html form in view in yii2 and there is a php file to send a message to the mail. How to include this php file in html form?
Answer the question
In order to leave comments, you need to log in
Isn't it easier to use swiftmailer?
/*в конфиге*/
'components' => [
'mail' => [
'class' => 'yii\swiftmailer\Mailer',
],
]
/*где нужно отправить письмо*/
$mail = Yii::$app->mail;
$mail->htmlLayout = "layouts/admin";
$mail->compose('@app/mail/changePassword/html.php', $arParams)
->setFrom(['[email protected]' => Yii::$app->name])
->setTo($this->email)
->setSubject('Восстановление пароля на сайте ' . Yii::$app->name)
->send();
/*$arParams - параметры передаваемые в шаблон письма*/
It is a question of connection of a file with a class of sending mail? require?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question