Skip to content

Instantly share code, notes, and snippets.

@yidas
Last active August 1, 2018 05:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yidas/7356b7fd12212f785ad24736d0346c57 to your computer and use it in GitHub Desktop.
Save yidas/7356b7fd12212f785ad24736d0346c57 to your computer and use it in GitHub Desktop.
[Yii2] Yii2 mailer set or disable layout template

[Yii2] Yii2 mailer set or disable layout template

Yii2 Mailer is extended by yii-mail-basemailer, which the compose() would render an mail view with default layout.

Set or Disable Mailer layout

$htmlLayout

[
    'components' => [
        'mailer' => [
            '__class' => yii\swiftmailer\Mailer::class,
            'htmlLayout' => false,
            'transport' => [
                '__class' => Swift_SmtpTransport::class,
                // ...
            ],
        ],
        // ...
    ],
    // ...
],
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment