# Email template overrides

Customize ImmoSync form emails from your WordPress theme without editing the plugin.

You can override:

- the **client** notification body (message sent to the agency / admin)
- the **recipient** confirmation body (message sent to the visitor)
- the shared **HTML layout** wrapping those bodies

## Setup

In your active theme (or child theme), create:

```
immosync/email/
```

Then add only the files you want to customize:

| Theme file | Overrides |
|---|---|
| `immosync/email/client-content.html` | `content/client-email.html` |
| `immosync/email/recipient-content.html` | `content/recipient-email.html` |
| `immosync/email/template.html` | `default.email.html` |

Example:

```
your-theme/
  immosync/
    email/
      client-content.html
      recipient-content.html
      template.html
```

## Resolution order

1. Child theme (`get_stylesheet_directory()`)
2. Parent theme (`get_template_directory()`), if different
3. Plugin default under `plugin/templates/email/`

If a file is missing in the theme, the plugin default is used. You can override one file and leave the others alone.

## How to start

1. Copy the matching plugin file into your theme path (rename as in the table above).
2. Edit the copy.
3. Submit a form to verify the email output.

Plugin sources to copy from:

- Body (client): `plugin/templates/email/content/client-email.html` → `immosync/email/client-content.html`
- Body (recipient): `plugin/templates/email/content/recipient-email.html` → `immosync/email/recipient-content.html`
- Layout: `plugin/templates/email/default.email.html` → `immosync/email/template.html`

## Placeholders (body templates)

Simple values (replaced as text):

- `{{ firstname }}`, `{{ lastname }}`, `{{ email }}`, `{{ phone }}`, `{{ message }}`
- `{{ source }}`, `{{ url }}`
- Address: `{{ addressStreet }}`, `{{ addressNumber }}`, `{{ addressBox }}`, `{{ addressZip }}`, `{{ addressCity }}`
- Search: `{{ searchPurpose }}`, `{{ searchCategory }}`, `{{ searchPriceMin }}`, `{{ searchPriceMax }}`, `{{ searchRooms }}`, `{{ searchAreaMin }}`, `{{ searchAreaMax }}`, `{{ searchZips }}`
- Estate: `{{ estateId }}`, `{{ estateReference }}`, `{{ estateName }}`

Conditional sections (content inside is kept only when the condition is truthy):

```html
{{#address}}
...
{{/address}}

{{#search}}
...
{{/search}}

{{#estate}}
...
{{/estate}}
```

## Placeholders (layout template)

Your layout file must include these tokens:

- `{{ email.headline }}`
- `{{ email.message }}` — rendered body content
- `{{ email.signature }}`
- `{{ email.footer }}`

## Limits

- Subject lines and From / To addresses stay controlled by plugin settings, not by these templates.
