# How to pass variables to the html email layout, not the view

**URL:** <https://discourse.cakephp.org/t/how-to-pass-variables-to-the-html-email-layout-not-the-view/3365>\
**Category:** Need Help\
**Created:** [October 18, 2017, 5:44pm UTC](https://discourse.cakephp.org/t/how-to-pass-variables-to-the-html-email-layout-not-the-view/3365 "2017-10-18T17:44:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![daniellowetz](https://avatars.discourse-cdn.com/v4/letter/d/5fc32e/32.png) [@daniellowetz](https://discourse.cakephp.org/u/daniellowetz)\
**Post date:** [October 18, 2017, 5:44pm UTC](https://discourse.cakephp.org/t/how-to-pass-variables-to-the-html-email-layout-not-the-view/3365/1 "2017-10-18T17:44:32Z")

</div>

I have some settings variables defined in my beforeFilter in AppController that I can access in layouts as needed. These settings include dynamic content/values set by users of a CMS framework I built on top of CakePHP. These variables don’t seem to be accessible in email layouts (Template \> Layout \> Email \> html \> default.ctp). I know you can send viewVars to email templates, but **how might I send variables from my controller to the email layout?** These variables are needed to dynamically set the header logo and footer legal copy of the email layout. I don’t want to have to code the headers and footers into every email template, as there will be many.

Any help would be greatly appreciated. Thanks!
