Здесь показаны различия между двумя версиями данной страницы.
| Предыдущая версия справа и слева Предыдущая версия Следующая версия | Предыдущая версия | ||
|
yii:yii2:swiftmailer [2021/07/28 16:34] werwolf |
yii:yii2:swiftmailer [2023/01/12 12:18] (текущий) |
||
|---|---|---|---|
| Строка 788: | Строка 788: | ||
| // Or use the constant to be more explicit | // Or use the constant to be more explicit | ||
| $message->setPriority(Swift_Mime_SimpleMessage::PRIORITY_HIGH); | $message->setPriority(Swift_Mime_SimpleMessage::PRIORITY_HIGH); | ||
| + | </code> | ||
| + | |||
| + | ====передать переменную в шаблон==== | ||
| + | |||
| + | <code php> | ||
| + | Yii::$app->mail | ||
| + | ->compose(['html' => 'layouts/html2'], ['content' => $content]) | ||
| + | ->setFrom(['noreply@mailer.com' => 'Mailer']) | ||
| + | </code> | ||
| + | |||
| + | <code html> | ||
| + | <body> | ||
| + | <?php $this->beginBody() ?> | ||
| + | <?= $content ?> | ||
| + | <?php $this->endBody() ?> | ||
| + | </body> | ||
| </code> | </code> | ||