Just like views layout. you need to create a new layout in mail/layouts/
for example I created a layout named “new-layout.php”

first get the mailer.

$mailer = Yii::$app->getMailer();

then define the layout.

$mailer->htmlLayout = 'layouts/new-layout';

final code.

$mailer = Yii::$app->getMailer();
$mailer->htmlLayout = 'layouts/new-layout';
Yii::$app->mailer->compose().....

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>