# Emails

The Privacy Request module allows you to communicate with your end-users while you are addressing their privacy requests.

A set of default emails have been created in order to help you use the product right away. Nevertheless, you can configure these emails in order to match your branding assets. Basically, you are able to add your own **HTML Template** and define the **email subject**. You can use as well the variables made available to integrate dynamic data or links in your emails.

## Create a new template

To create a new template, you need to send a **POST** request on `/marketplace/emails` endpoint and specify the provider (`type_id`), the type of email (`email_type`) as well as the subject and the HTML of your email template.

{% hint style="info" %}
By creating a new template, you will replace the one provided by default.
{% endhint %}

```json
POST https://api.didomi.io/marketplace/emails

{
    "type_id": "didomi",
    /**
    * Email types available are detailled below.
    * For instance, to verify user identity, 
    * you will be using `request-verify` email
    */
    "email_type": "Email ID",
    "properties": {
        "html": "Your HTML",
        "subject": "Your subject"
    }
}
```

💡 Note that we are only referring to a `didomi` provider in this section. You can also use your own provider. The workflow will be noticeably the same with your own provider, nevertheless further configuration will be required. To fetch provider configuration schemas, send a GET request on `/marketplace/emails/properties-schema`.

```json
GET https://api.didomi.io/marketplace/emails/properties-schema
```

### Configure recipient email address (reply-to)

To configure the recipients of an email, you need to configure the `reply_to` property in `properties` options. You can add one or several recipient addresses in `reply_to` property.

`reply_to` property can be configured for both default template and your own templates.

```json
PATCH https://api.didomi.io/marketplace/emails/{id}

{
    "type_id": "didomi",
    "email_type": "Email ID",
    "properties": {
        "reply_to": ["email1@address.com", "email2@address.com"]
    }
} 
```

{% hint style="warning" %}
Be careful when you are editing the `properties` property. This is a JSONB and by design, you need to fill in every property already added every time you edit this object. If you have added your own HTML and now want to set a `reply_to`, you need to provide both `html` and `reply_to` in order to not erase your previous changes.
{% endhint %}

## Emails available by default

In the Privacy Request Management Platform, emails are sent on **request creation** or **status update**. Please find below the list of emails available by default with their dynamic parameters.

* [Access Data Request fulfillment notification](#access-data-request-fulfillment-notification)
* [Delete Data Request fulfillment notification](#delete-data-request-fulfillment-notification)
* [Identity verification](#identity-verification)
* [Opt out Data request fulfillment notification](#opt-out-request-fulfillment-notification)
* [Refusal notification](#refusal-notification)
* [Work in progress notification](#work-in-progress-notification)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developers.didomi.io/api-and-platform/privacy-requests/emails.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
