> Documentation index: https://sema4.ai/docs/llms.txt
> Web page: https://sema4.ai/docs/v3/build/project-context/email-templates

# Email templates

Your AP team writes the same replies all day: "your invoice will pay Tuesday". Your shipping desk does too: "your order ships Friday". Your support team: "we received your request, here is the ticket number". Each one carries different specifics for a different vendor, customer, or order, but the shape is the same.

Email templates capture that shape once. When inbound mail hits a mailbox bound to one of your Workflows, the agent picks the right template by name and fills in the specifics from the work item. The sender gets a fast answer in your voice. Your team gets out of the repetitive-reply business.

**Audience:** builders

> **Templates live on the Project; the wiring lives on the Workflow.** Author here. When you want a mailbox to trigger a Workflow and reply through one of these templates, see [Bound email](https://sema4.ai/docs/v3/build/workflows/bound-email.md).

## Find the Email templates section

Open your Project. Click the **Context** tab. Pick the **Email templates** section. The list shows every template in the Project: name, what it sends, placeholders, mailbox actions, status, and last edited.

Each template is a file at `email_templates/<slug>.md` in the Project volume. The path is intentional. Agents can author into `email_templates/` directly during a conversation; system paths under `.blockparty/` are off limits.

## Create a template

### Click New template

The button is in the section head, top right. A naming panel slides in.

### Pick a slug

The slug becomes the filename: `email_templates/<slug>.md`. Lowercase letters, numbers, underscores, and dashes are allowed. Up to 64 characters.

### Click Create and open editor

The template opens in its own tab, beside whatever else you have open. Close the tab to put it away; the Email templates section in the Context tree opens it again.

> **Name for the situation, not the order.** Templates are referenced by name from a conversation or a Workflow. `vendor_invoice_status_query` and `remit_confirmation` survive a year of edits. `template1` and `new_template` will not.

## The editor

A reference rail beside three tabs.

- **Reference rail.** A sample inbound payload and a Placeholders card. Click any `inbound.*` row to drop `{{ inbound.sender_name }}` (or similar) at the cursor. Declare `values.*` keys you want the agent to fill in. In a narrow tab the rail moves below the tabs rather than beside them.
- **Settings.** Subject, description, and mailbox actions.
- **Body.** A code editor with jinja2 syntax highlighting and line numbers.
- **Preview.** The rendered result, described below.

The body and the settings persist independently in the draft. The action cluster in the top bar shows your save state: **Saved** when clean, **Unsaved** when dirty. Save commits the draft to the volume. Delete removes the file.

## Preview against a sample inbound

Open the **Preview** tab to render the draft you are editing against the sample inbound payload, including edits you have not saved. It shows the subject, the body, and the mailbox actions that would fire on send.

If something is wrong, the preview returns a structured error:

- **Undefined variable.** A `{{ values.X }}` reference has no declared key. Add the key in the Placeholders card or guard it with a default.
- **Template settings are invalid.** The settings block failed to parse, most often an unquoted colon in a subject such as `subject: Re: your invoice`. A template in this state opens as **Needs repair** with the parse error and its location, and offers to repair it with the agent, refresh, or delete it.
- **Template renders empty.** The body is blank after rendering.
- **Render failed.** Anything else from the renderer.

The error card calls out the offending variable by name when it can, and offers a fix to declare it or guard the reference.

## Add an image

**Add image** in the Body tab stores a picture alongside the template, under `email_templates/assets/`, and inserts a reference to it. Several templates can use the same picture: the file is stored once and shared.

When the reply sends, each reference travels inside the message rather than as a link to somewhere the recipient's mail client may not reach, which is the form Gmail and Outlook display. A picture pasted from another mail client, such as a signature carrying a logo, is stored the same way when you save instead of being dropped.

Two things follow from that:

- **Images require HTML.** A markdown template switches format when you add the first image. The editor tells you before it does.
- **A missing picture stops the send.** If a referenced file has been deleted, the preview and the send both fail and say which reference is unresolved, rather than mailing a broken frame.

Pictures you link to with an ordinary `https` URL are left alone and fetched by the recipient's mail client as usual.

## Mailbox actions

Open the **Settings** tab to set what your agent does to the inbound email when this reply sends: mark read, add Outlook categories, add Gmail labels. Provider-irrelevant fields are dropped at dispatch.

## Reference the template by name

Once saved, the template is reachable by slug. A Workflow picks a template by name and passes the placeholder values it wants filled in. The agent renders the template, the platform sends from the bound mailbox, and the reply threads into the original message.

For the full inbound-to-reply wiring through a Workflow, see [Bound email](https://sema4.ai/docs/v3/build/workflows/bound-email.md).
