# Mailjet

[Mailjet](https://www.mailjet.com/) provides email sending services that help you stay connected with your customers. If you already use Mailjet to send company-related emails of any type, you can also use the Mailjet account in the Emporix platform. By default, Emporix provides email service that holds all email templates for communication between your store and your customers. But, it is possible to integrate your custom Mailjet account so that you keep your company theme in the emails related to commerce operations and keep your email templates in one place.

## Enabling custom Mailjet account

To connect your Mailjet account with Emporix email service, contact the [Emporix Support Team](mailto:support@emporix.com) and provide the following information:

* credentials:
  * `publickey`
  * `secretkey`
* `sender` - optionally, if you'd like to send the emails from a specific email address:
  * `emailAddress`
  * `name`
* `template ID` numbers - if you want to use your custom email templates, the ID numbers for each language version to be used

The Support Team enables the Mailjet account on the Emporix side, according to your preferences.

## Languages

It is possible to create a template for each language version you commonly use in your setup. Provide Emporix with the template IDs for each of them so that we can configure the mailing service accordingly.

For example:

```
{ //...

  "languages": {
    "en": 2464336,
    "de": 2472042,
    "fr": 6542186,
    "pt": 9877541,
    "pl": 7412588
  }

//...
}
```

## Custom email templates

Using your own Mailjet account allows you to create custom email templates to inform about different actions in the system, apart from the default email templates delivered by Emporix. You can prepare email templates, that are sent out upon different triggers, both internally within your company or externally to your customers. Among other triggers, the emails may concern:

* new customer in the system
* order confirmation
* invoice generation
* password reset
* shipping confirmation
* coupons received

You can adjust the templates according to your needs and preferences. However, if you want to include information coming directly from the Emporix system, like order ID, delivery times etc, make sure your templates use the appropriate Emporix **variables** to display the information properly.

### Common variables

{% hint style="success" %}
If you want to include some more information in your templates, that is not listed below, please contact the [Emporix Support Team](mailto:support@emporix.com) to help you find the appropriate variables.
{% endhint %}

| Variable                       | Description                                  |
| ------------------------------ | -------------------------------------------- |
| **Change Email Request**       |                                              |
| `customer`                     | customer's name                              |
| `newEmail`                     | new email address to be updated              |
| `oldEmail`                     | previous email address used                  |
| **Coupon**                     |                                              |
| `customer`                     | customer's details                           |
| `coupon`                       | coupon id                                    |
| `couponIsValidUntil`           | end date of coupon validity period           |
| **Customer**                   |                                              |
| `additionalBillingEmail`       | email address for billing purposes           |
| `birthday`                     | customer's birthday                          |
| `customerEmail`                | customer's email address                     |
| `customerGeneralAttributes`    | customer-related information                 |
| `customerNumber`               | customer's id number                         |
| `customerToken`                | customer token generated at login            |
| `firstName`                    | customer's first name                        |
| `invoiceNotDeliveryAddress`    | address for invoicing purposes               |
| `lastDeliveryDate`             | date of last delivery to customer            |
| `lastName`                     | customer's last name                         |
| `mobilePhone`                  | customer's mobile phone number               |
| `tenant`                       | tenant associated with the customer          |
| `title`                        | customer's title                             |
| `token` (`activateAccountUrl`) | token used for customer's account activation |
| **Delivery**                   |                                              |
| `deliveryDate`                 | date of delivery                             |
| `errorMessage`                 | error notification message content           |
| `orderNumber`                  | order id                                     |
| `triggeredAction`              | action taken on the delivery failure         |
| **Invoice**                    |                                              |
| `orderNumber`                  | order id number                              |
| `archiveEmail`                 | email address for invoice archiving          |
| `documentType`                 | type of document                             |
| `linkToInvoice`                | invoice link                                 |
| **Order**                      |                                              |
| `billingAddress`               | address associated with billing              |
| `comment`                      | comment made on order                        |
| `computedDeliveryTime`         | time of delivery                             |
| `customer`                     | customer associated with the order           |
| `customerGeneralAttributes`    | customer's details                           |
| `customerName`                 | name of the customer                         |
| `customerTitle`                | customer's title                             |
| `date`                         | date of creating the order                   |
| `deliveryDate`                 | date of delivery                             |
| `deliveryTimeFrom`             | time of delivery range - from                |
| `deliveryTimeFromAmPm`         | time of delivery range - from AM/PM          |
| `deliveryTimeTo`               | time of delivery range - to                  |
| `deliveryTimeToAmPm`           | time of delivery - to AM/PM                  |
| `discounts`                    | discounts assigned to the order              |
| `entries`                      | order entries                                |
| `feeTotal`                     | all fees applied to the order                |
| `firstName`                    | customer's first name                        |
| `lastName`                     | customer's last name                         |
| `linkToInvoice`                | link to the invoice                          |
| `orderNumber`                  | order id number                              |
| `orderReplaces`                | id of replaced order                         |
| `packaging`                    | packaging details                            |
| `paymentCosts`                 | costs associated with payment                |
| `paymentMethod`                | payment method chosen for the order          |
| `pickup`                       | info if pickup was chosen for delivery       |
| `pickupAddress`                | address for the order pickup                 |
| `shippingAddress`              | address for shipping the order               |
| `shippingCosts`                | costs associated with shipping goods         |
| `substituteProduct`            | product substituted by                       |
| **Password Reset**             |                                              |
| `customer`                     | customer requesting a password reset         |
| `fullResetLink`                | link to reset the password                   |
| **Support**                    |                                              |
| `message`                      | content of a message to support              |
| `subject`                      | subject of the message to support            |

{% hint style="success" %}
To better understand how to construct the custom email templates, refer to the [Mailjet Syntax Reference](https://dev.mailjet.com/email/template-language/reference/) guide.
{% endhint %}
