# Emails

Beauty Router emails your users about their orders, payments, deliveries, and verification. The emails carry your app's
name, logo, and color, and every link opens your salon app. Your users have no Beauty Router login, so no email sends
them to a Beauty Router page.

## Emails your users get

Emails go to the address from the user's latest [login](/authentication/). Order emails go to the users of the company.
Company emails go only to users with [`canManageCompany`](/authentication/#users-who-cannot-change-company-settings). The two
card emails also go to users with [`canOrder`](/authentication/#users-who-cannot-order), who can change the card.
The Back in stock email goes only to the user who asked.

### Orders

The statuses are the ones in [Orders](/orders/#statuses). Every order email links to the order.

| Email             | When Beauty Router sends it                                                                                      |
| ----------------- | ---------------------------------------------------------------------------------------------------------------- |
| Order received    | An order waits in `pending_verification`, with no charge yet.                                                    |
| Order placed      | The card was charged, and the order is `placed`. This email is the receipt.                                      |
| Payment failed    | The card charge failed (`payment_failed`). Beauty Router tries again after 24 hours when the failure can be retried. |
| Order shipped     | The order shipped (`in_transit`). The email has the tracking links.                                              |
| Out for delivery  | The carrier is delivering the package today.                                                                     |
| Ready for pickup  | The carrier holds the package for pickup.                                                                        |
| Delivered         | The order was delivered (`delivered`).                                                                           |
| Delivery failed   | The delivery failed (`delivery_failed`).                                                                         |
| Order canceled    | The order was canceled (`canceled`). The email says why, and whether the card was refunded.                      |
| Rate your order   | Three days after delivery, if the user has not rated the order yet. The email links to `orderUrl`.               |

### Company

| Email                 | When Beauty Router sends it                                                                               |
| --------------------- | --------------------------------------------------------------------------------------------------------- |
| Company verified      | The review ended, and the company is `verified`. The email links to the marketplace.                      |
| Verification declined | The company did not pass the review (`declined`). The email has the reviewer's note.                      |
| Changes reviewed      | Beauty Router approved or declined a [change after verification](/companies/#changes-after-verification). |
| Document expires soon | A license or an exemption certificate expires in one month.                                               |
| Document expired      | A license or an exemption certificate expired today.                                                      |
| Card expires soon     | The payment card expires next month.                                                                      |
| Card expired          | The payment card expired.                                                                                 |

Every company email except Company verified links to the verification page.

### Products

| Email         | When Beauty Router sends it                                                                |
| ------------- | ------------------------------------------------------------------------------------------ |
| Back in stock | A product the user asked to hear about is available again. The email links to the product. |

## How they look

- **Sender:** your app's name, from a Beauty Router address, such as `Roselane <orders@mail.beautyrouter.com>`.
- **Your brand:** your logo at the top, and your accent color on buttons and links.
- **Footer:** every email ends with "Powered by Beauty Router", with Beauty Router's support contact.
- **Receipt:** the Order placed email names the brand or distributor that sold the products and shows the sales tax.

Your users know your app, so they open emails that come from it. Beauty Router is the merchant of record: it charges the
card, collects sales tax as the marketplace facilitator, handles refunds, and answers questions about orders. That is why
the footer, card statements, and support name Beauty Router, and the rest of the email is yours.

The embedded interface shows a small mark for the same reason. See [Embedded marketplace](/embedded-marketplace/#beauty-router-mark).

## Replies and support

Replies go to Beauty Router's order support, which sees the order, the payment, and the delivery. When your users ask
you about an order, a payment, a refund, or a delivery, send them there. Questions about your app stay with you.

## What you set up

Set these in the salon app admin area when you [get access](/support/#get-access).

| Setting       | What it is                                                                                                                |
| ------------- | ------------------------------------------------------------------------------------------------------------------------- |
| App name      | The name your users know. It is the sender name, and it cannot contain "Beauty Router".                                   |
| Logo          | PNG on a transparent background, up to 2 MB. Emails show it 40 pixels high, so make it at least 80 pixels high.           |
| Accent color  | One color as hex, such as `#2F6F5E`. Buttons and links use it. Buttons have white text, so pick a color it reads well on. |
| URL templates | The pages in your salon app that email links open. See [URL templates](#url-templates).                                   |

The app name and all four URL templates are [required](/support/#get-access). With no logo, emails show your app name as
text. With no accent color, they use a neutral default.

### URL templates

Each template is an HTTPS URL on one of your [registered origins](/embedded-marketplace/#before-you-start). Beauty Router
replaces the placeholders with Beauty Router IDs.

| Template          | Example                                                    | Used by                                     |
| ----------------- | ---------------------------------------------------------- | ------------------------------------------- |
| `orderUrl`        | `https://app.example.com/orders/{orderId}`                 | Every order email                           |
| `productUrl`      | `https://app.example.com/marketplace/products/{productId}` | Back in stock                               |
| `verificationUrl` | `https://app.example.com/settings/verification`            | Every company email except Company verified |
| `marketplaceUrl`  | `https://app.example.com/marketplace`                      | Company verified                            |

| Placeholder   | Value                                                                                                  |
| ------------- | ------------------------------------------------------------------------------------------------------ |
| `{orderId}`   | The order ID, such as `order-8Jd3kFs6Gh`. Only in `orderUrl`.                                            |
| `{productId}` | The product ID, such as `prod-4Fz9QbX2kL`. Only in `productUrl`.                                        |
| `{companyId}` | The company ID, such as `loc-7Hk2pQx9Lm`. In any template, for a person who works at several locations. |

Each page signs the user in when needed, then shows the matching screen with the
[JavaScript library](/embedded-marketplace/):

- `orderUrl`: the order with `showOrder(element, orderId)`, where the salon can also rate it.
- `productUrl`: the product with `showProductDetails(element, productId, { marketplaceFeatures: true })`.
- `verificationUrl`: the verification page with `showVerification(element)`.
- `marketplaceUrl`: the marketplace with `showMarketplace(element)`.

## Send from your own domain

The emails can come from your own domain, such as `orders@app.example.com`. You set this up in the salon app admin area.

1. **Domain setup.** You pick the domain or subdomain that sends, such as `app.example.com`. Beauty Router gives you
   three CNAME records: two sign the emails (DKIM), and one sets up a bounce subdomain that handles SPF. Your root SPF
   record does not change. You add the records to your DNS, and Beauty Router verifies them.
2. **Settings.** You choose the from address, such as `orders@app.example.com`, and the from name. Replies still go to
   Beauty Router's order support.
3. **Fallback.** Until the domain is verified, emails go out from Beauty Router's address. Beauty Router checks the records
   every day. If a check fails, emails go out from Beauty Router's address again until you fix them, and Beauty Router
   tells you.