> For the complete documentation index, see [llms.txt](https://docs.powerfulform.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.powerfulform.com/email-notifications/dynamic-fields.md).

# Insert form answers into an email

Put a visitor's answers and submission details into the subject line and body of your notification emails.

A notification is far more useful when the subject line already says who wrote in and what about. Powerful Contact Form Builder does that with variables: short placeholders you drop into the **Subject** or **Content** of either email, which the app swaps for the real answer as it sends.

Everything on this page works the same in the **Admin** notification and in the **Auto Responder**.

## The syntax

A variable is a name wrapped in double curly braces, like `{{data}}` or `{{email}}`. Type it, or use one of the two inserters described below so you never mistype a name.

The app replaces it with the answer when the email goes out. A variable whose field the visitor left blank, or that was hidden by conditional logic, produces nothing at all — the rest of the sentence still reads normally.

## Insert one into the subject line

Click the database icon beside the **Subject** label. A list opens under the heading **Form inputs** containing:

| Item                    | Variable          | What you get                                                                        |
| ----------------------- | ----------------- | ----------------------------------------------------------------------------------- |
| **Submission ID**       | `{{id}}`          | The number of this submission in the app.                                           |
| **Form ID**             | `{{form.id}}`     | The form's own number.                                                              |
| **Form name**           | `{{form.name}}`   | The form's title.                                                                   |
| **Ticket ID**           | `{{ticket.name}}` | The ticket reference, on forms that use the ticket system.                          |
| Every field on the form | `{{fieldId}}`     | That field's answer. Each row shows the field's label with its variable underneath. |

Click a row and the variable is added to the end of what is already in **Subject**. Move it where you want it with the keyboard.

<figure><img src="https://2907469752-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FehM2rz7MmKkWcJmgvJOe%2Fuploads%2Fgit-blob-b622032b5c78a9e45cbd2ea6cd538fc98c9da0d8%2Fscreenshot-mail-notification-subject-variable-inserter.png?alt=media" alt="The Subject field in the Mail panel with the database icon beside its label clicked, showing the Form inputs list with Submission ID, Form ID, Form name, Ticket ID and several form fields, each with its variable underneath."><figcaption><p>The Subject field in the Mail panel with the database icon beside its label clicked, showing the Form inputs list with Submission ID, Form ID, Form name, Ticket ID and several form fields, each with its variable underneath.</p></figcaption></figure>

## Insert one into the body

Above the **Content** editor sits a list of variables with the note *You can use variables which will help you create a dynamic content.*

Click a variable to copy it — the tooltip reads *Click here to copy variable* and a **Copied!** confirmation appears — then click into the editor and paste it where it belongs.

The list starts with six entries:

| Item                       | Variable             | What you get                                        |
| -------------------------- | -------------------- | --------------------------------------------------- |
| **All visible input data** | `{{data}}`           | Every answer on the submission as a labeled list.   |
| **Form name**              | `{{form.name}}`      | The form's title.                                   |
| **Customer name**          | `{{customer.name}}`  | The name on the visitor's Shopify customer account. |
| **Customer email**         | `{{customer.email}}` | The address on that account.                        |
| **Page title**             | `{{page.title}}`     | The title of the page the form was submitted from.  |
| **Page url**               | `{{page.href}}`      | The address of that page.                           |

Click **Show more** at the bottom and the list expands to include every field on the form, each shown by its label with its own variable. **Show less** collapses it again.

{% hint style="info" %}
The note under the variable list reads *Note: The customer variable is only available when the customer is logged in.* `{{customer.name}}` and `{{customer.email}}` are blank for visitors who submit the form without signing in, so never build a greeting that depends on them alone.
{% endhint %}

## What `{{data}}` produces

`{{data}}` is the single most useful variable and the reason both shipped templates already contain a **More information** block. It expands into a list of every answer, each on its own line as *Field label: answer*.

Within that list:

* Answers the visitor left blank are skipped entirely.
* Uploaded files appear as clickable links, and uploaded images also show a preview.
* A **Product** or **Quantity** field is laid out as a table, with a subtotal row when the field is set to count one.
* A **Matrix** field is written out as text.

Because it adapts on its own, `{{data}}` keeps working when you add or remove fields later. Individual field variables do not — those need updating by hand.

## A worked example

Take a wholesale inquiry form with a **Name** field, an **Email** field, a **Dropdown** asking *Which product range?* and a **Textarea** for the message.

{% stepper %}
{% step %}

#### Write the subject

In the **Admin** section, set **Subject** to:

```
New wholesale enquiry from {{name}} — {{range}}
```

Use the database icon to insert `{{name}}` and `{{range}}` so the field names are exactly right.
{% endstep %}

{% step %}

#### Write the body

In **Content**, keep the shipped template and edit the opening line to:

```
{{name}} asked about {{range}} on {{page.title}}.
```

Leave the **More information** block with `{{data}}` in it, so the full set of answers still follows.
{% endstep %}

{% step %}

#### Write the confirmation

In the **Auto Responder** section, set **Subject** to:

```
We have your enquiry, {{name}}
```

and open the body with a line that uses the same variable.
{% endstep %}

{% step %}

#### Save and test

Click **Save** on the Shopify save bar, then submit the form on your storefront and read both emails.
{% endstep %}
{% endstepper %}

The result in your inbox reads *New wholesale inquiry from Dana Reid — Outdoor*, which you can scan, search and filter without opening anything.

## Things to check

{% hint style="warning" %}
A variable that does not match a field name is left out silently — you get *New inquiry from* with nothing after it. Always insert variables from the list rather than typing them, and send one test submission after every change.
{% endhint %}

* Renaming a field's label does not break its variable, but deleting the field does. Reopen the inserter and pick the replacement.
* `{{ticket.name}}` only produces a value on forms where the ticket system is switched on. Elsewhere it produces nothing.
* Variables work the same in every language version of the subject and body. Insert them again in each language you translate.

{% hint style="success" %}
When your test email arrives with real answers in the subject line, the variables are set up correctly.
{% endhint %}

<br>

## Next steps

* [Edit an email template](/email-notifications/email-template-editor.md) — formatting, images and links around your variables.
* [Admin email notification](/email-notifications/admin-notification.md) — the settings that surround the subject and body.
* [Customer autoresponder](/email-notifications/customer-autoresponder.md) — greet the visitor by name.
* [Open a submission](/submissions/view-submissions.md#open-a-submission) — see the stored answers the variables come from.
