# Email settings

In this section of the documentation, you will find information regarding the **Emails** settings:

![email-settings-menu-items.png](./attachments/email-settings-menu-items.png)

* * *

<a id="create-an-email-template"></a>

## Create an email template

HBook allows you to create a diversity of email templates that can be sent out automatically or manually, taking into account the reservation status, the payment status, the language, and the accommodation type.

> [!INFO]
> If you have a multi-language plugin (as Polylang or WPML), you will see an extra column “For language” that allows you to set for which language the email template is set for. So you can have different emails sent according to the language.

![email-template.png](./attachments/email-template.png)

To create email templates, just follow these steps:

1. Click on **Add new template**
2. Enter the **name** of the new template
3. Enter the information for the **To**: Insert a complete e-mail address, e.g. Name <email@domain.com>. If the field is blank, the email address of the WordPress administrator will be used.
4. Enter the information for the **Reply-to**: This email will be used instead of the “From” email when replying to the email
5. Enter the information for the **From:**. If the field is blank the default email address, as set in [HBook > Misc](../hbook-documentation/misc-settings.md#misc-misc) will be used, or if not set, the WordPress administrator email will be used.
6. Enter the information for the **BCC:**.
7. Enter the **subject** for the new template
8. Write the **body** of the message
9. Select if you wish to use **Text or HTML** format
10. If you wish to include **attachments**, you can select them here. It will open your **Media** library, from which you can select all documents to attach.
11. It is possible to create email templates for the following situations:
  - [Upon an event](#upon-an-event): the email is automatically sent when a reservation is received, confirmed or cancelled…
  - [Scheduled](#scheduled): the email is automatically sent “x” days before/after the check-in/check-out date
  - [Manually](#manually): the email is sent manually from the reservations list

The set-up is different for each case and are explained in details after.  

> [!INFO]
> Please check [this section](../hbook-documentation/list-of-variables.md) of our documentation for a **list of the variables** that can be used in the email templates.

* * *

<a id="presentation-of-the-different-types-of-email-templates"></a>

## Presentation of the different types of email templates

You can create different templates that can be for emails sent upon an event, scheduled emails or emails sent manually.

<a id="upon-an-event"></a>

### Upon an event

![email-template-event.png](./attachments/email-template-event.png)

1. Select the **events** that should trigger the sending of the email. There are 6 different actions, and you can select several for the same template:
  - Automatically when a **new reservation is received**: a customer has just booked on your website (front-end)
  - Automatically when a **new reservation is added from the back-end**: a reservation has been added in the admin page [Reservations](../hbook-documentation/reservations.md).
  - Automatically when a **reservation is confirmed**: when you click on the green tick in the reservation list. Note that clicking on the “Confirm” action will always trigger this action, even if you don't require confirmation. See [Confirmation settings](../hbook-documentation/misc-settings.md#reservations-status) for more details on this.
  - Automatically when a **reservation is cancelled**: when you click on the red cross in the reservation list.
  - Automatically when you receive a **Payment via Payment link:** when a customer has paid from a payment link page. See [Payment link settings](../hbook-documentation/payment-settings.md#payment-link-settings) for more information on this.
  - Automatically when a customer adds a **New payment method via Payment link**: when you have asked a customer to update/add a payment method for a future charge or refund.
2. Select the **payment status** for which the template should be sent. There are 4 different payment statuses, and you can select several for the same template.
  - Paid
  - Not fully paid
  - Unpaid
  - Delayed payment (payment methods for which payment status confirmation is not immediate)
3. Select the **accommodation types** for which the template is.
4. If you have enabled multiple accommodation booking in **HBook > Misc**, you can select if this template is to be sent out for a **multiple accommodation booking.**
5. If your website is set with multiple language, you can select here for which **language** the template is.

<a id="scheduled"></a>

### Scheduled

![email-template-scheduled.png](./attachments/email-template-scheduled.png)

1. Indicate the timeframe for the scheduled event :
  - indicate the **number of days**
  - indicate if it is to be sent **before check-in**, **after check-in**, **before check-out**, **after check-out**
2. Select the [reservation status](../hbook-documentation/reservations/reservation-list.md#reservation-table-status) for which the template should be sent. There are 3 different reservation statuses, and you can select several for the same template:
  - New
  - Pending
  - Confirmed
3. Select the [payment status](../hbook-documentation/reservations/reservation-list.md#customer-payment-status) for which the template should be sent. There are 4 different payment statuses, and you can select several for the same template.
  - Paid
  - Not fully paid
  - Unpaid
  - Delayed payment (payment methods for which payment status confirmation is not immediate)
4. Select the **accommodation types** for which the template is.
5. If you have enabled multiple accommodation booking in **HBook > Misc**, you can select if this template is to be sent out for a **multiple accommodation booking.**
6. If your website is set with multiple language, you can select here for which **language** the template is.

<a id="manually"></a>

### Manually

![email-template-manually.png](./attachments/email-template-manually.png)

1. Select the **accommodation types** for which the template is.
2. If you have enabled multiple accommodation booking in **HBook > Misc**, you can select if this template is to be sent out for a **multiple accommodation booking.**
3. If your website is set with multiple language, you can select here for which **language** the template is.

> [!NOTE]
> **Example of a list of email templates**
> ![email-template-examples.png](./attachments/email-template-examples.png)

* * *

<a id="email-logs"></a>

## Email logs

HBook keep a log of the emails sent. They are displayed by reverse chronological order.

![email-template-logs.png](./attachments/email-template-logs.png)

1. This is the timestamp, local time.
2. Here is indicated for which reservation ID the email was sent.
3. If a template was used, the template name is indicated here.
4. The trigger for the email is displayed here. You will see if it was sent manually, as part of the scheduled emails or upon an event
5. The email sending status is shown here. If an email is not sent out, you will find the error here.
6. You can delete all email logs

> [!INFO]
> Please have in mind that the sending status is not the delivery status. An email can be sent but not received!
> There are various levers to improve deliverability : you can connect your site with your mail server via SMTP, improve your content to avoid your email being treated as Spam, etc.

> [!NOTE]
> See [here](https://maestrel.atlassian.net/wiki/spaces/KB/pages/63177022/The+emails+are+not+sent) in our knowledge base for more information regarding emails not being received correctly.