

You don’t need to install anything to build a basic template either, just go to the MJML Try It Live page. I use MJML most of the time to generate the HTML I need for email. You could also break this into separate Twig files and include sub-templates based on your conditional statements. Now you can customize welcome email headers, forgotten password headers, etc. If you don’t provide a custom template, Craft CMS comes with a default built-in HTML email template, which you can see in the Github repository in ‘templates/_special/email.html’.Īs you can see there is a single variable, Like all templates in Craft, the HTML email template is written in Twig. You’ll find this option in the Settings > Email section of the Craft control panel. You can change this though by providing an HTML Email Template. Obviously, they are not designed to match the branding of the site you’re building. What is the HTML email template?Ĭraft needs to send transactional emails to users and, by default, these emails are basic. As with most of my posts, this is not just for you, but for future-me when I stumble upon this task again. A workflow platform for designers, developers and marketers to collaborate on emails.
MJML CODE FOR A LINE HOW TO
In this post, I’ll share what I know about using and customizing the HTML email template in Craft. Scalero lays out the tips and tricks on how to code MJML emails, including a sample email code to help get started. If you are working directly with developers, adding a line or code block prior to the html element via grunt/gulp should be simple enough. If you search the Craft Discord community, you’ll find documentation nuggets scattered in conversations.

Searching the Craft documentation doesn’t turn up much information. The HTML Email Template is pretty basic and hasn’t received much love in the docs yet. The documentation of Craft CMS improves constantly but for a CMS that evolves at the pace we’re used to with Craft, keeping up with documenting every nook and cranny doesn’t always happen.
