Take the 2-minute tour ×
Craft CMS Stack Exchange is a question and answer site for administrators, end users, developers and designers for Craft CMS. It's 100% free, no registration required.

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 %}
share|improve this question

1 Answer 1

up vote 3 down vote accepted

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:

<html>
    <body>
        <div>
            {{ body }}
        </div>
    </body>
</html>
share|improve this answer
    
Thanks for the reply! –  Niall Thompson Aug 3 at 0:38

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.