Skip to content

Templates

The mail every app sends, ready to go.

50 built-in layouts for sign-in, security, billing and product notices, in five colour themes. Or write your own in Handlebars. Send either one by slug.

Built-in layouts

50 layouts, rendered for real.

Every thumbnail below is the HTML the Worker produces for that layout with sample values. Pick a theme, filter by category and open one to see its variables.

Theme

Showing 50 of 50 layouts

The built-in layouts share one structure, so they differ in the fields they show and the words around them, not in their design. They are read-only. If you want a specific look, write a custom template.

Two kinds

Built-in layouts and your own templates.

You send both the same way. A slug in the request is all it takes.

50 built-in layouts

Added to your database by a migration when you deploy, as system templates. Each one lists the variables it uses. Change the look with a theme, and send by slug, such as welcome or password-reset. They cannot be edited or deleted.

Custom templates

Write your own subject, HTML body and optional plain-text body. Choose a slug of lowercase letters, numbers and hyphens, and optionally scope the template to one domain. If the slug is taken, EmailFlare adds a short suffix and tells you the final one.

Handlebars guide

The syntax, with real output.

Each result below was produced by the same renderer your Worker runs, when this page was built.

Variables

Put a value in double braces. Pass the values in variables when you send. The same variables fill the subject line.

template
<p>Hi {{name}},</p>
<p>Order <strong>{{orderId}}</strong> is on its way.</p>
variables
{
  "name": "Alex",
  "orderId": "ORD-1042"
}

Result

<p>Hi Alex,</p>
<p>Order <strong>ORD-1042</strong> is on its way.</p>

Nested values

Reach into objects with dots. variables can hold objects as well as strings and numbers.

template
{{plan.name}} plan, renews {{plan.renewsOn}}
variables
{
  "plan": {
    "name": "Pro",
    "renewsOn": "Dec 1"
  }
}

Result

Pro plan, renews Dec 1

Conditionals

Show a block only when a value is set, with an optional else. unless does the reverse. Empty strings, empty lists, zero and false count as not set.

template
{{#if trialDays}}
  Your trial ends in {{trialDays}} days.
{{else}}
  Thanks for being a customer.
{{/if}}
variables
{
  "trialDays": 3
}

Result

Your trial ends in 3 days.

Missing values

A variable you do not send renders as nothing. It never shows as {{code}} to your customer, but it can leave a gap, so check the output in the playground.

template
Hi {{name}}, your code is {{code}}.
variables
{
  "name": "Alex"
}

Result

Hi Alex, your code is .

Repeated rows

Build lists in your own code and pass the finished markup. The template inserts it as written.

template
<ul>{{items}}</ul>
variables
{
  "items": "<li>Widget</li><li>Gadget</li>"
}

Result

<ul><li>Widget</li><li>Gadget</li></ul>

Styling

Use inline CSS, which is the most reliable across mail clients. Pass colours and fonts as variables to reuse one template across brands.

template
<h1 style="color: {{brandColor}};
           font-family: {{font}};">
  Hello {{name}}
</h1>
variables
{
  "name": "Alex",
  "brandColor": "#f97316",
  "font": "Arial, sans-serif"
}

Result

<h1 style="color: #f97316;
           font-family: Arial, sans-serif;">
  Hello Alex
</h1>

Themes

Five colour themes for the built-in layouts.

Set themeId on the request. The theme changes the accent, background and text colours, and nothing else.

  • Default

    themeId: "default"

  • Ocean

    themeId: "ocean"

  • Forest

    themeId: "forest"

  • Violet

    themeId: "violet"

  • Slate

    themeId: "slate"

In your code

Send by slug. Pass the variables.

No template engine in your app and no HTML in your repository. Change the email in the dashboard and the next send uses it.

  • subject in the request overrides the template subject
  • variables fill the subject and, for custom templates, the body
  • A test key renders the template into the test mailbox without delivering it
See the full API
POST /v1/send
curl -X POST https://your-emailflare.workers.dev/v1/send \
  -H "Authorization: Bearer eflive_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "from": "hello@yourdomain.com",
    "to": "alex@example.com",
    "templateSlug": "welcome",
    "themeId": "ocean",
    "variables": {
      "name": "Alex",
      "appName": "Acme",
      "loginUrl": "https://app.acme.dev/login"
    }
  }'

In the dashboard

Search, preview and write templates.

The Templates page lists every layout and custom template. Open one to preview it with sample variables and a theme, or create a new template.

  • Search by name, slug or subject
  • Preview built-in layouts in any theme
  • Create custom templates with a subject, HTML and plain-text body
  • Test a send from the playground before you ship
The Templates page listing built-in layouts with a search box and category filters

FAQ

Template questions.

Stop hard-coding email in your app.

Deploy EmailFlare, pick a layout and send it by slug. Your templates and your mail stay in your own account.