Spanish Total.js
English
Documentation For AI agents
Contents

Template markup

Put your data into the email with markup, a sample model, helpers and images.

.md GitHub
On this page

The HTML of a template uses markup in double curly braces. When your app sends an email, the data it sends is available as value.

Open the editor

Open a profile and click a template card. The editor shows the HTML on the left and a preview inside the profile layout on the right.

The template editor with the HTML on the left and the preview on the right

Click SUBMIT to save, or Cancel to close without saving.

Show values

<p>Hello {{ value.name }},</p>
<p>Your <b>{{ value.plan }}</b> plan is ready.</p>

If your app sends "data": { "name": "Jane Doe", "plan": "Pro" }, the email says "Hello Jane Doe, Your Pro plan is ready."

  • Values are HTML-encoded: <i> in your data shows as text, not as italic.
  • A value that your app does not send stays empty.

Sample data for the preview

Add a JSON block with sample data. The preview uses it, and Bulk send fills its Model field with it. Emails sent by your apps use only the data the app sends.

<script type="text/json">
    {
        "name": "Jane Doe",
        "plan": "Pro"
    }
</script>

Your apps can read this sample data with List profiles, as the model of each template.

Helpers

Helpers format a value. Write them in a <script> block in the template, or in the layout to share them with all templates:

<p>Your <b>{{ value.plan | upper }}</b> plan is ready.</p>

<script>
    Thelpers.upper = function(val) {
        return val ? val.toUpperCase() : '';
    };
</script>

The subject

The Subject of a template can use the same markup and data, for example:

Invoice {{ value.number }}

Your app can also send its own subject; it replaces the subject of the template. See Send an email.

Images

To add an image to a template:

1. In the editor, put the cursor where the address of the image should go and right-click.

2. Choose Upload file and pick the image.

OpenMail stores the file and inserts its public address, for example https://mail.example.com/download/JaqA9b1cW61f.png. Use it in an img tag:

<img src="https://mail.example.com/download/JaqA9b1cW61f.png" alt="Demo project" width="120" />

The address uses the host name you opened the admin interface with. Open it at its public address, not 127.0.0.1, before you upload images, or recipients cannot load them.

Made in Europe