<p><a href="http://buildwithcraft.com/docs/apis/emailservice#sendEmailByKey">EmailService->sendEmailByKey()</a> sets the <code>htmlBody</code> property of <code>EmailModel</code> to this:</p>

<pre><code>$emailModel-&gt;htmlBody = "{% extends '{$template}' %}\n".
    "{% set body %}\n".
        $emailModel-&gt;htmlBody.
    "{% endset %}\n";
</code></pre>

<p>So if you've got a custom email template in <code>craft/templates/email.html</code>, in the control panel under Settings → Email → HTML Email Template, you'd set the value to <code>email.html</code>.</p>

<p>And you'd simply output the dynamic email content in your template by using <code>{{ body }}</code> like so:</p>

<pre><code>&lt;html&gt;
    &lt;body&gt;
        &lt;div&gt;
            {{ body }}
        &lt;/div&gt;
    &lt;/body&gt;
&lt;/html&gt;
</code></pre>

CC BY-SA 3.0
2014-08-03T00:23:02.257Z
2014-08-03T00:23:02.257Z
Brad Bell
<p>I know I can set the template in the email settings to use a HTML template but how do I pass the content of the system messages (activate your account, reset your password, etc) to this template?</p>

<p>I've added this to the html template but then the email that is sent is blank:</p>

<pre><code>{% block content %}
{% endblock %}
</code></pre>

<emails>
Pass content of system messages to HTML Email Template
# Pass content of system messages to HTML Email Template

(Asked by: username_0 on 2014-08-02)

I know I can set the template in the email settings to use a HTML template but how do I pass the content of the system messages (activate your account, reset your password, etc) to this template?
I've added this to the html template but then the email that is sent is blank:
{% block content %}
{% endblock %}

**Tags:** emails


---

## 1 answers

### Answer by username_1 on 2014-08-03. Score: 14 | Accepted answer

EmailService->sendEmailByKey() sets the htmlBody property of EmailModel to this:
$emailModel->htmlBody = "{% extends '{$template}' %}\n".
    "{% set body %}\n".
        $emailModel->htmlBody.
    "{% endset %}\n";

So if you've got a custom email template in craft/templates/email.html, in the control panel under Settings → Email → HTML Email Template, you'd set the value to email.html.
And you'd simply output the dynamic email content in your template by using {{ body }} like so:

    
        
            {{ body }}


---

