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

# Email templates

## How to create email templates

1. Navigate to **Communications** > **Email Templates** and click on the  **+ ADD NEW EMAIL TEMPLATE** button.
2. Select an email template type to create an email template based on your requirements. The following email template types are available:
   * **Invoice**: to send invoice-related emails to customers.
   * **Payment Reminder**: to send payment reminders to customers.
   * **Usage Report**: to send usage reports based on latest aggregates to customers.
   * **Refund Receipt**: to send refund receipts to customers.
   * **Contract Document**: to send contract documents to customers.
   * **Custom Email**: flexible general-purpose templates.
   * **Payment Receipt**: to send payment receipts to customers.

<Image alt="Fig. 1: Select an email template type" align="center" border={true} src="https://files.readme.io/f05da8b-Screenshot_from_2024-04-01_13-18-18.png">
  Fig. 1: Select an email template type
</Image>

### Invoice email template

<Image align="center" className="border" border={true} src="https://files.readme.io/6d18057-Screenshot_from_2024-04-01_13-15-46.png" />

1. Enter a name for the template.
2. Add an email attachment. Currently, **Invoice**, **Payment Receipt**, and **Refund Receipt** can be attached.

> 🚧 Note
>
> Email attachments are **document templates**. The Email Attachments drop-down will show all existing document templates. You must create document templates by navigating to **Communications** > **Document Templates**.

3. Input template data: subject and body of the email. The Insert Variables drop-down can be used to add placeholders in the body of the email. The Zenskar backend will replace the placeholders with contextually relevant values when an email is sent.

   The following variables are available:

| Customer variables |
| :----------------- |
| Name               |
| ID                 |
| External ID        |
| Address            |
| Email              |

| Invoice variables   |
| :------------------ |
| Number              |
| Invoice date        |
| Due date            |
| Total               |
| Due amount          |
| Payment link        |
| Billing cycle start |
| Billing cycle end   |
| Billing duration    |

4. The email template editor allows you to add the following to your email template body:
   * **hyperlinks**: select the word you wish to display as a hyperlink, and use the link tool ![](https://files.readme.io/49dd1d4-Screenshot_from_2023-10-25_15-24-08.png) from the bottom toolbar to create a hyperlink to a location on the web.
   * **hidden elements**: if you wish to include certain *keywords* in the emails that are invisible to your customers, you can use the hide tool ![](https://files.readme.io/657e10b-Screenshot_from_2023-10-25_15-24-12.png). This gives you the ability to perform keyword-based searches in your mail client while not cluttering the emails you send.
   * **images**: you can use the image tool ![](https://files.readme.io/0932aa7-Screenshot_from_2023-10-25_15-24-15.png) to either insert an image URL or your organization's logo.

<Image align="center" className="border" border={true} src="https://files.readme.io/36cbfc1-Screenshot_from_2024-04-01_13-21-02.png" />

> 🚧 Organization logo
>
> Navigate to **Settings** > **General**, and click on the **CHANGE LOGO** button to upload your organization's logo.

5. Save the template by clicking the **ADD NEW EMAIL TEMPLATE** button.

All existing email templates can be viewed by navigating to **Communications** > **Email Templates**.

<Image align="center" className="border" border={true} src="https://files.readme.io/6204f72-Screenshot_from_2024-04-01_13-16-21.png" />

### Payment receipt email template

The process is similar to invoice email template creation. Refer the [invoice email template creation process](https://docs.zenskar.com/docs/email-templates#invoice-email-template).

### Usage report email template

The process is similar to [invoice email template creation process](https://docs.zenskar.com/docs/email-templates#invoice-email-template) with the following differences:

1. Email attachment option is **not** available.
2. Option to add aggregates is available.
3. Emails can be sent to customers anytime by clicking on the **SEND EMAIL** button on the email templates page.

<Image align="center" className="border" border={true} src="https://files.readme.io/ccfc65d-Screenshot_from_2023-10-25_16-58-59.png" />

> 🚧 Note
>
> The Insert Aggregate drop-down will show all existing aggregates. You must add aggregates by navigating to **Metering** >  **Usage Aggregates**.

<Image align="center" className="border" border={true} src="https://files.readme.io/569f5b1-Screenshot_from_2023-10-25_16-54-28.png" />

### Refund receipt email template

The process is similar to invoice email template creation. Refer the [invoice email template creation process](https://docs.zenskar.com/docs/email-templates#invoice-email-template).

### Contract document email template

The process is similar to invoice email template creation. Refer the [invoice email template creation process](https://docs.zenskar.com/docs/email-templates#invoice-email-template).

### Custom email template

If the above email template types do not meet your requirements, the flexibility of the custom email template may be what you are looking for.

The process is similar to invoice email template creation with the following differences:

1. Email attachment option is **not** available.
2. Emails can be sent to customers anytime.

#### Sending emails

1. Navigate to **Communications** > **Email Templates**.
2. Click on the kebab menu at the end of the row you are interested in.

<Image align="center" className="border" border={true} src="https://files.readme.io/e6deb57-Screenshot_from_2024-04-01_13-17-08.png" />

3. Select email recipients(s) using the **Select Customers** drop-down.

> ❗️ Note
>
> * The **Select Customers** drop-down will list all existing customers. You must add customers before exercising this option.
> * The CSV file must include either the `external_id` or `customer_id` to identify the recipients. If neither of these IDs is included, an error message will be displayed.

4. If needed, you can edit the email template before sending the mail.
5. Once you have ensured that correctness of all the data, click on the **SEND EMAIL** button.

<Image align="center" className="border" border={true} src="https://files.readme.io/c6ad805-Screenshot_from_2024-04-01_13-24-22.png" />
