Templates
Design an email once, with fields, conditions and lists, then send it by id. Build it block by block in the dashboard, start from the library, or write your own HTML.
The quick way: the dashboard
Open Templates in the dashboard. Add one from the library (sixty ready-made emails in six categories: onboarding, security, e-commerce, WooCommerce, billing and notifications, from welcome and password reset to every WooCommerce order email), or build one from blocks, or paste your own HTML. The preview updates as you type, with sample data you can change.
Publish from code
curl -X POST 'https://api.sendsend.email/v1/templates' \
-H "Authorization: Bearer $SENDSEND_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"id": "welcome",
"subject": "Welcome, {{first_name}}",
"html": "<p>Hi {{first_name}}!</p>",
"variables": { "first_name": { "type": "string", "required": true } }
}'Send it with template_id and variables. Do not combine a template with subject, html or text.
curl -X POST 'https://api.sendsend.email/v1/emails' \
-H "Authorization: Bearer $SENDSEND_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"from": "Acme <hello@mail.acme.com>",
"to": ["maria@example.com"],
"template_id": "welcome",
"variables": { "first_name": "Maria" }
}'Fields, conditions and lists
The template language is small on purpose: nothing in it can run code.
Hi {{ first_name | there }}, a fallback when it is missing
{{ total | currency:'USD' }} filters: upper, lower, title, truncate:40, currency:'USD', number, date, join:', ', size, trim
{{#if plan == 'pro'}}Thanks for going Pro!{{else}}Upgrade any time.{{/if}}
{{#each items as item}}
{{ item.name }}: {{ item.price | currency:'USD' }}
{{/each}}- Conditions compare with
==,!=,>,>=,<,<=, and can start withnot. Write text in single quotes. - Inside a loop,
{{@index}},{{@first}}and{{@last}}are available. Loops can nest to four levels. - Values are escaped in HTML, so user-supplied text cannot inject markup. Links given as a variable only work if they start with https://, http:// or mailto:.
- A template can repeat at most 3,000 times in all, and the data sent with a send can be up to 64 KB.
- A mistake, or a field the template uses without declaring it, is refused when you publish, with a message that says where.
Variables
- Declare every field you use under
variables, with a type ofstring,number,boolean,array(a list, for loops and tables) orobject. - A missing or mistyped variable fails the send with
invalid_variablesand lists the problems.
Blocks
The visual builder has headings, text, buttons, images, logos, dividers and spacing, image-and-text columns, product cards, discount codes, social links, lists, quotes, signatures, events and a five-step rating survey. For templates there are two more: show only when on any block (paid or plan == 'pro') and a table from a list, which repeats a row for each item in a list variable. Reuse a block you like with Save for reuse.
Countdown timers and accordions are not offered: email programs do not run the code they need.
Your brand
The Brand kit holds your logo, colors, font and footer. They are put on a library template when you add it. The API reads and changes it too.
Versions
Posting an existing id publishes the next version. Versions are immutable. Pin one with template_version, or omit it to use the latest. To go back, Make newest (or restore) publishes a copy of an old version as the newest. Nothing is lost.
Languages
Add translations when you publish: { "fr": { "subject": "Bienvenue", "html": "…" } }. Send with "language": "fr" to use it. Anything a translation leaves out comes from the main version, and fr-CA falls back to fr. We do not translate for you: bring your own text.
Split test two or more versions
On the Split test tab, or with PATCH /v1/templates/{id}, share traffic across up to five versions, for example 50 and 50. Sends that name no version are divided by those percentages, and the same recipient always gets the same version. Compare the versions with the template stats: sent, delivered, bounced, and opens and clicks when tracking is on.
Plain text
If you publish HTML without a plain-text version, we make one from the HTML, with links kept. A visual design gets one too.
Try it before you send it
Preview renders a version with sample data and sends nothing. A test send mails one address through the normal sending path. Test sends are left out of the stats.