[Sugester V2 EN](https://sugester.intum.pl/kb/sugester-v2-en.md) / [Forms](https://sugester.intum.pl/kb/sugester-v2-en/forms.md)

# [Automatic email replies from forms (templates)](https://sugester.intum.pl/kb/sugester-v2-en/automatic-email-replies-from-forms-templates.md)

## Automatic Email Replies from Forms

After filling out the form, the system can automatically send a confirmation email to the client. The content of the email is configurable and may depend on the selected option in the form.

## Configuration

To enable auto-reply, the form needs:

1. **Confirmation Mailbox** (`confirmation_mailbox`) – sender's address (e.g. `formularze@firma.pl`)
2. **Client Email Field** (`client_email_field`) – indicates which field in the form contains the recipient's email
3. **Confirmation Subject** (`confirmation_subject`) – subject of the email
4. **Confirmation Body** (`confirmation_body`) – content of the email, supports Liquid

## Liquid Variables

In the confirmation body, you can use variables corresponding to the field codes of the form:

```
{{ email }} → value of the field with code "email"
{{ imie }} → value of the field with code "imie"
{{ temat }} → value of the field with code "temat"
```

You set the field code in the field editing of the form (field "Code").

## Conditional Content (Liquid)

You can use `if` conditions for different content depending on the responses:

```liquid
{% if temat == "Question about the offer" %}
  Thank you for your interest! We will get back to you soon.
{% elsif temat == "Account deletion" %}
  We have received your request regarding account deletion.
{% endif %}
```

## Mail::Template Templates

For more complex HTML emails, instead of entering the entire content in the confirmation field, you can refer to an email template:

```liquid
{% if temat == "Question about the offer" %}template:1 Questions > Offer{% endif %}
{% if temat == "Account deletion" %}template:1 Questions > Account Deletion{% endif %}
```

Where `template:Template Name` is a reference to the template in the Mail → Templates module. The system:

1. Renders Liquid in `confirmation_body`
2. If the result starts with `template:` – it searches for the template by name
3. Uses the content and subject from the found template
4. If the template has "Liquid" checked – it also renders variables in the template content

## Internal Notification

In addition to the reply to the client, the form can send a notification to the team:

- **Notification Mailbox** (`notification_mailbox`) – the mailbox where the information about the new request will arrive
- The email contains the responses from the form and a link to the result in the panel

## Flow Summary

```
Client fills out the form
  → Form::Result.create
  → Notification to the team (notification_mailbox)
  → Reply to the client (confirmation_mailbox)
    → Liquid parses confirmation_body
    → If result = template:Name → loads Mail::Template
    → Sends email with template content
```