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

# Email Templates

> Customize the email templates ABBYY Vantage Self-Hosted sends to users, including subject, body, and template parameters, to match your company branding.

Default email texts sent by Vantage include ABBYY-specific information, such as ABBYY customer support emails, GDPR notices from ABBYY, and footers with ABBYY copyrights. You can modify the templates for these emails to include your own details and make them specific to your company.

## Available Email Templates

Vantage offers the following email templates:

| Email Template                                                                 | ID                                     | Culture | Subject Template Parameters | Body Template Parameters                                                                                                                                                       |
| ------------------------------------------------------------------------------ | -------------------------------------- | ------- | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Invitation email sent to the tenant administrator of a newly created tenant    | `E6F03F64-B982-49C6-B336-251CA6C45FFE` | en      | `productName`               | `userName` - the name of the user to whom the email is being sent, `productName` - the name of the product, `invitationUri` - the invitation link to create an account         |
| Invitation email sent to the newly created tenant                              | `6C5DBE28-0A2C-4EB7-82DC-04173DC75418` | en      | `productName`               | `userName` - the name of the user to whom the email is being sent, `productName` - the name of the product, `invitationUri` - the invitation link to create an account         |
| Email with a password reset link requested by a user on the Vantage login page | `701B077A-20EA-42B8-A71E-AB3EA5996039` | en      | N/A                         | `displayName` - optional display username provided during registration, `callbackUrl` - the link to reset password, `expireHours` - the number of hours until the link expires |
| Email about a successful skill export to a shared folder                       | `B5A03F64-B982-49C6-B336-251CA6C45FFE` | en      | N/A                         | `userName` - the user email address, `skillName` - the skill that is being exported, `folderPath` - the path to the shared folder                                              |
| Email about an unsuccessful skill export to a shared folder                    | `F3C4BD68-B9FF-439F-A719-5B4F62263C4E` | en      | N/A                         | `userName` - the user email, `skillName` - the skill that is being exported, `errorMessage` - the error message body                                                           |

## Modifying an Email Template

To modify an email template, follow these steps:

1. [Get access to the Vantage mail service](#getting-access-to-the-vantage-mail-service)
2. [Get the email template details](#getting-the-email-template-details)
3. [Update the email template](#updating-an-email-template)

## Getting Access to the Vantage Mail Service

To get access to the mail service:

1. Get access to the Mail service API through `http://localhost:8080` or another port:

```bash theme={null}
kubectl -n abbyy-vantage port-forward $(kubectl get service -n abbyy-vantage --selector='app.kubernetes.io/name=mail' -o name) 8080:80
```

Sample terminal output:

```
Forwarding from 127.0.0.1:8080 -> 8080
Forwarding from [::1]:8080 -> 8080
```

## Getting the Email Template Details

To get the markup for an existing email template, send a GET request to the templates resource (`http://localhost:8080`) as follows:

```
GET http://localhost:8080/api/v1/templates/{templateId}
```

Sample response:

```json theme={null}
{
  "localizedTemplates": {
    "en": {
      "subjectTemplate": "Your invitation to {{productName}}",
      "bodyTemplate": "<body>...</body>"
    }
  },
  "id": "<templateId>",
  "createTime": "2022-04-06T07:23:52.903261+00:00",
  "updateTime": "2022-04-06T07:23:53.137142+00:00"
}
```

<Note>
  The response will not contain the attachments, which will instead be placed in the email template. They must be specified and can additionally be modified when updating the template.
</Note>

## Updating an Email Template

To replace an email template, send a PUT request to the templates resource:

```
PUT http://localhost:8080/api/v1/templates/{templateId}
```

Request body:

```json theme={null}
{
  "culture": "en",
  "subjectTemplate": "subject template",
  "bodyTemplate": "body template",
  "attachments": [
    {
      "contentType": "attachment MIME",
      "contentId": "guid",
      "fileName": "image name used in body as cid",
      "content": "file content in base64 string"
    }
  ]
}
```

### Template Elements

| Field                       | Type         | Description                                                                                          |
| --------------------------- | ------------ | ---------------------------------------------------------------------------------------------------- |
| `templateId`                | GUID         | Identifier of the email template to be modified                                                      |
| `culture`                   | string       | Template language. Currently, only English (en) is supported                                         |
| `subjectTemplate`           | string       | Email header text template. See the previous section for information on how to get the current value |
| `bodyTemplate`              | string       | Email body template. See the previous section for information on how to get the current value        |
| `attachments[].contentType` | string       | MIME type of the attachment (for example, `image/png`)                                               |
| `attachments[].contentId`   | string       | Unique identifier for the attachment                                                                 |
| `attachments[].fileName`    | string       | Attachment file name, can be used in the body as CID                                                 |
| `attachments[].content`     | base64string | Attachment file encoded in base64 format                                                             |

<Note>
  The subject and body template parameters must remain unchanged. Do not add, remove, or modify them.
</Note>

<Note>
  Always include all attachments, even if you don't intend to modify them. The request completely replaces the email template.
</Note>

### Default Attachments

Every Vantage email template contains these four attached images:

| CID                            | MIME Type | Image                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| ------------------------------ | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `logo-vantage-logo-normal.png` | image/png | <img src="https://mintcdn.com/abbyy/fPfipzT-K9Hr52Ze/images/vantage/tenant-admin/logo-vantage.svg?fit=max&auto=format&n=fPfipzT-K9Hr52Ze&q=85&s=3c5d6adea6cb0c60626d6bb935948421" alt="ABBYY Vantage logo" width="159" height="24" data-path="images/vantage/tenant-admin/logo-vantage.svg" /> |
| `600-px-copy-6.png`            | image/png | <img src="https://mintlify.s3.us-west-1.amazonaws.com/abbyy/images/vantage/self-hosted/misc-p01-044.png" alt="Decorative header image" />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `16-headset-16@2x.png`         | image/png | <Icon icon="headset" />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `16-global-outline-16@2x.png`  | image/png | <Icon icon="globe" />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |

### Sample Request

```
PUT http://localhost:8080/api/v1/templates/E6F03F64-B982-49C6-B336-251CA6C45FFE
```

```json theme={null}
{
  "culture": "en",
  "subjectTemplate": "Your {{productName}} account information",
  "bodyTemplate": "<body><table ...>...<img ... src=\"cid:logo-vantage-logo-normal.png\" alt=\"ABBYY Vantage\" />...Dear {{userName}},...</body>",
  "attachments": [
    {
      "contentType": "image/png",
      "contentId": "4dcc3114-b7ff-48b5-902a-8fbd673d6acd",
      "fileName": "logo-vantage-logo-normal.png",
      "content": "iVBORw0KGgoAAAANSUhEUgAAALoAAAAcCAMAAADhlVUwAAAA..."
    },
    {
      "contentType": "image/png",
      "contentId": "e243efa2-55ed-4f07-a1e0-27d55460decc",
      "fileName": "600-px-copy-6.png",
      "content": "iVBORw0KGgoAAAANSUhEUgAAAlgAAACkCAMAAAB8d6ClAAAA..."
    },
    {
      "contentType": "image/png",
      "contentId": "d57f26bb-43b6-41a3-b356-3f53dfbd28d7",
      "fileName": "16-headset-16@2x.png",
      "content": "iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAA..."
    },
    {
      "contentType": "image/png",
      "contentId": "df64ab94-9c7f-49d1-93bf-f7ba48eb2a98",
      "fileName": "16-global-outline-16@2x.png",
      "content": "iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAA..."
    }
  ]
}
```

### Converting Files to Base64

To get the base64 string representation of a file, execute the following command:

```powershell theme={null}
[Convert]::ToBase64String([IO.File]::ReadAllBytes("full path to file"))
```
