---
title: Template markup
project: OpenMail
version: 1.0
section: guides
language: en
license: MIT
url: https://totaljs.es/docs/openmail/1-0/guides/template-markup/
updated: 2026-11-19T07:58:07.018Z
---

# Template markup

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

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](/files/JapWJq21s60f.webp)

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

## Show values

```html
<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](../bulk-send/) fills its **Model** field with it. Emails sent by your apps use only the data the app sends.

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

Your apps can read this sample data with [List profiles](../../reference/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](../layout/) to share them with all templates:

```html
<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:

```text
Invoice {{ value.number }}
```

Your app can also send its own `subject`; it replaces the subject of the template. See [Send an email](../../reference/send-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:

```html
<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.
