Email Templates

https://z.explo.org/documents/email_templates

Email templates are the way that Z handles the familiar "merge email" problem: needing to send the same email to a lot of recipients, with some information conditionally changing depending on details of any given recipient.

Making Your Own Template

The email template system in Z goes the extra mile and allows email templates to use the almost any Elixir language construct to define logic in the email templates.

To make a template, start here. Type your template information into the relevant fields, and double-check in the "live preview" that things are looking like they should.

To reference variable data or perform calculations, you can use any Elixir syntax in your templates. You "wrap" the Elixir code in EEx template tags, like so:

# in Elixir...
iex> 1 + 1
2

# in an HTML template...
<%= 1 + 1 %>
2

Example / Starter Templates

We've created some sample templates to help give a better idea of what's possible. Click each link below to be brought into an HTML template editor with the example pre-loaded:

  • Example Email with variables, HTML, and conditional statements in the template.

Resources

We've put together some further reading that may prove helpful.

Z System

Here in Z, these are the modules that contain HTML template code and documentation.