> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dealtoaster.io/llms.txt
> Use this file to discover all available pages before exploring further.

# The template language

> Personalize subjects and emails with variables, fallbacks, helpers, dates, random variants and conditional blocks.

Subjects and email bodies can contain variables that DealToaster fills in for each contact when the email is sent. A variable is written between double braces, for example `{{first_name}}`. This page lists everything you can write. In the step editor, **Insert variable** adds most of it for you; see [Build a sequence](https://docs.dealtoaster.io/guides/sequences.md).

## Variables

Contact variables come from the contact's fields: `{{first_name}}`, `{{last_name}}`, `{{email}}`, `{{company}}`, `{{title}}`, `{{phone}}`, `{{linkedin_url}}`, `{{website}}`, `{{city}}` and `{{country}}`.

Computed variables are worked out from the contact:

* `{{full_name}}`: the first and last name together.
* `{{email_domain}}`: the part of the email address after the `@`.
* `{{last_touch}}`: when you last emailed the contact from DealToaster, in words such as "today", a weekday, "last Tuesday", "2 weeks ago", "last month" or "in March". It is empty for a contact you never emailed, so give it a fallback.

Custom variables are your own contact fields, written `{{custom.name}}`, where `name` is the field name.

Sender variables describe you: `{{sender_first_name}}`, `{{sender_last_name}}`, `{{sender_full_name}}` and `{{sender_email}}` come from the mailbox's display name and address; `{{sender_company}}`, `{{sender_title}}`, `{{sender_phone}}` and `{{sender_calendar_url}}` come from the sender details in your profile settings.

The unsubscribe link is `{{unsubscribe_url}}`. Every email carries an unsubscribe link: if your email does not show it, DealToaster adds a footer line with it.

A name that is not on this page is refused when you save the step, and the message names the character where it starts.

## Fallbacks

A fallback is used when the contact has no value. Write it after a vertical bar:

```text theme={null}
Hi {{first_name | "there"}},
```

A fallback can be another variable, and you can chain several. The first one that is not empty wins, and a chain ends in a text or a variable:

```text theme={null}
Hi {{first_name | custom.nickname | "there"}},
```

Write a double quote inside a fallback text as `\"`.

If a variable has no fallback and its value is empty for a contact, DealToaster never sends a blank. For step 1, **Add contacts** does not add the contact and reports "Missing data for step 1". For a later step, the contact is set aside as **Needs attention** with the reason "Missing" followed by the variable names, and you can fix the contact and resume. The preview warns you about it. Variables used only inside a condition are optional.

## Change the case of a value

`capitalize`, `lowercase` and `uppercase` change the case of a variable or a chain, and the fallback too:

```text theme={null}
{{capitalize first_name | "there"}}
{{uppercase company}}
```

## Dates

These variables use the sequence's time zone and are never empty:

| Variable | Writes |
| - | - |
| `{{today}}` | The weekday, for example "Tuesday". |
| `{{tomorrow}}` | The weekday of tomorrow. |
| `{{now_date}}` | The date, for example "January 5, 2027". |
| `{{now_month}}` | The month name. |
| `{{now_quarter}}` | "Q1" to "Q4". |
| `{{now_year}}` | The year. |
| `{{time_of_day}}` | "morning" (06:00 to 12:00), "afternoon" (12:00 to 18:00), "evening" (18:00 to midnight) or "night" (midnight to 06:00). |

Date helpers take one whole number from 0 to 365, for example `{{days_from_now 2}}`:

* `days_from_now` and `days_before_now` write the weekday that many days ahead or back.
* `weekdays_from_now` and `weekdays_before_now` count working days, Monday to Friday.
* `month_from_now` and `month_before_now` write a month name.
* `quarter_from_now` and `quarter_before_now` write "Q1" to "Q4".

A helper takes no fallback.

## Random variants

Vary the wording between contacts with two to twenty texts in double quotes:

```text theme={null}
{{random "Hi" "Hello" "Hey"}}
```

A retry of the same email keeps its variant. The preview and the test email can show a different variant than the real send.

## Blocks

Show text only when a condition holds with `{{#if}}` and `{{#unless}}`, with an optional `{{else}}`:

```text theme={null}
{{#if company}}I saw what {{company}} is building.{{else}}I saw what you are building.{{/if}}
```

A value that shows nothing, such as an empty field or only spaces, counts as empty, and empty is false. The condition-only variables `is_monday` to `is_sunday`, `is_weekday` and `is_weekend` work in blocks, and are refused as output.

Compare values with `eq`, `ne`, `gt`, `gte`, `lt`, `lte` and `contains` between a variable and a text or number, or between two variables:

```text theme={null}
{{#if (eq custom.plan "pro")}}Thanks for being on Pro.{{/if}}
```

* Numbers compare as numbers when both sides are plain decimals; `gt`, `gte`, `lt` and `lte` are false when a side is not a number.
* `eq` and `ne` on text ignore capitals and surrounding spaces. `contains` ignores capitals and is false when a side is empty.
* There is no `{{else if}}`. Blocks can be nested up to 10 deep.

## What you cannot write

The language is deliberately small. Loops, partials, raw output, comments and similar constructs are refused when you save. A template can be at most 102,400 characters and 500 tags. A link whose whole target is a variable keeps its text but loses its address when you save, except `{{unsubscribe_url}}` and `{{sender_calendar_url}}`. A variable can sit inside a link after a full address, for example `https://example.com/?ref={{custom.code}}`.

Only `https`, `http`, `mailto` and `tel` addresses are kept in links.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.