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

# Custom HTML Email Templates for Form Notifications

> Create custom HTML notification emails in formcarry using dynamic template tags, conditional blocks, fallback values, and field iteration.

formcarry's custom email templates let you write your own HTML for both self (owner) notifications and respondent (auto-reply) emails. Instead of relying on formcarry's default layout, you control every word, style, and structure of the message — and use dynamic template tags to inject real submission data wherever you need it.

<Note>
  Custom Email Templates are only available on Growth and Premium plans.
</Note>

## Dynamic Tags

Use `{{fieldName}}` to insert the value of any submitted field directly into your template. If your form contains an input named `telephone`, write `{{telephone}}` anywhere in your HTML and formcarry will replace that tag with the value the respondent submitted.

```html theme={null}
Name: {{name}} <br/>
Email: {{email}} <br/>
Telephone: {{telephone}} <br/>
```

Every field in your form has a corresponding tag — just match the tag name to your input's `name` attribute.

## Conditional Blocks

Not every field is always filled in. Use `{{#fieldName}}...{{/fieldName}}` to render a block of content **only when that field has a value**. This keeps your email clean when optional fields are left empty.

```html theme={null}
Submitter Name: {{name}} <br/>

{{#email}}
Submitter Email: {{email}} <br/>
{{/email}}

Submitter Attachment: {{attachment}} <br/>
```

In the example above, the email line is only rendered when the `email` field is not empty. The `attachment` line outside a conditional block is always rendered, regardless of whether it has a value.

## Fallback Values

When you want to display a placeholder for an empty or missing field instead of hiding it, use the `{{#fallback}}` syntax:

```html theme={null}
{{#fallback}}variable | fallback value{{/fallback}}
```

For example, to show "Not provided" when `telephone` is blank:

```html theme={null}
Telephone: {{#fallback}}telephone | Not provided{{/fallback}} <br/>
```

If `telephone` has a value, formcarry renders that value. If the field is empty or was not submitted, formcarry renders `Not provided` instead.

## Iterating Fields

Use `{{#fields}}` to loop over every submitted field and render each key–value pair. Use `{{#attachments}}` to do the same for any uploaded files.

```html theme={null}
{{#fields}}
  {{key}}: {{value}}
{{/fields}}

{{#attachments}}
  {{key}}: {{value}}
{{/attachments}}
```

<Note>
  You can only iterate `fields` and `attachments`. Other custom loops are not supported.
</Note>

## Full Example

Below is a complete custom HTML template for an event registration confirmation email. The form collects `first_name`, `last_name`, `email`, and the optional fields `telephone` and `special_requirements`.

```html theme={null}
Subject: Event Registration Confirmation - {{first_name}} {{last_name}}

---

Dear {{first_name}},

Thank you for registering for our upcoming event! We're excited to have you join us. Here are the details of your registration:

Name: {{first_name}} {{last_name}}
Email: {{email}}

{{#telephone}}
Telephone: {{#fallback}}telephone | Not provided{{/fallback}}
{{/telephone}}

{{#special_requirements}}
Special Requirements: {{#fallback}}special_requirements | None{{/fallback}}
{{/special_requirements}}

Please let us know if any of the above information is incorrect or if you have any questions.

Looking forward to seeing you at the event!

Best regards,
The Event Team
```

The subject line personalises itself with the participant's full name. Optional fields like `telephone` and `special_requirements` are wrapped in conditional blocks so they only appear when the respondent actually provided them, with fallback values ready if they did not.

## Troubleshooting

formcarry's template engine requires every opened block to have a matching closing tag:

```html theme={null}
{{#fields}}   <!-- open block  -->
{{/fields}}   <!-- close block -->
```

If a block is left open, formcarry cannot parse the template and will **not** replace any tags in your email. To diagnose this:

1. Open the **preview panel** — it always uses your most recent submission as sample data and will display a syntax-error warning if it detects unclosed blocks.
2. Check every `{{#fieldName}}` in your template for a corresponding `{{/fieldName}}`.
3. If template tags still appear unresolved after fixing the syntax, contact the formcarry team via live chat.

<Tip>
  The preview panel always uses your most recent submission as sample data, so send a test submission first to make the preview as realistic as possible.
</Tip>


## Related topics

- [Set Up Email Notifications for Your Forms](/docs/features/email-notifications.md)
- [Create a form](/docs/api-reference/forms/create-a-form.md)
- [Update a form](/docs/api-reference/forms/update-a-form.md)
- [List forms](/docs/api-reference/forms/list-forms.md)
- [Retrieve a form](/docs/api-reference/forms/retrieve-a-form.md)
