# Custom domains

Use a custom domain to receive mail at addresses that you control. An inbound route receives mail for every recipient on its configured domain.

Use a dedicated subdomain, such as `replies.example.com`, if your main domain uses another mail provider. An MX record directs mail for the configured domain to Lettermint.

## Choose an exact or wildcard domain

| Choose | Matching behavior |
| --- | --- |
| Exact domain | Receive mail for one domain, such as `replies.example.com`. |
| Wildcard domain | Receive mail for subdomains below one domain, such as `*.replies.example.com`. |

An exact domain matches only the configured domain:

- `support@replies.example.com` matches `replies.example.com`.
- `support@eu.replies.example.com` does not match `replies.example.com`.

A wildcard domain matches one or more subdomains below the configured domain:

- `support@eu.replies.example.com` matches `*.replies.example.com`.
- `support@vip.eu.replies.example.com` also matches `*.replies.example.com`.
- `support@replies.example.com` does not match `*.replies.example.com`.

The last address uses the base domain. Configure the exact domain on a separate route if you must receive it.

If more than one custom domain matches, Lettermint uses this order:

1. An exact custom domain.
2. The most specific wildcard domain.

For example, `*.eu.example.com` receives mail for `customer.eu.example.com` instead of `*.example.com`.

## Configure the domain

<Stepper>

### Add the catch-all domain

1. Open the inbound route and select **Settings**.
2. Find **Use your own domain**.
3. Enter the domain in **Catch-all domain**.
4. Select **Save changes**.

Enter an exact domain such as `replies.example.com`. For a wildcard domain, enter `*.replies.example.com`.

You can use a wildcard only at the left side of the domain.

### Add the MX record

Create this record with your DNS provider:

| Field | Value |
| --- | --- |
| Type | `MX` |
| Host | `replies.example.com` |
| Priority | `10` |
| Value | `inbound.lettermint.co` |

For a wildcard route, use the wildcard domain as the record name. For example, use `*.replies.example.com`.

DNS providers use different formats for record names. Some require only the host. Other providers require the complete domain.

Do not add `https://` or an IP address to the MX value.

### Verify the MX record

Return to the route **Settings** page. Select **Verify**.

Lettermint marks the domain as verified when it finds the expected MX record.

### Send a test message

Send an email to any address on the verified domain. For example, send to `support@replies.example.com`.

Open the webhook delivery log. Confirm that your endpoint received `message.inbound`.

</Stepper>

## Route recipients with plus addressing

Custom domains preserve plus tags in the webhook payload. Use a plus tag to route messages without creating additional inbound routes.

For a message sent to `support+order-4821@replies.example.com`:

```json
{
  "recipient": "support+order-4821@replies.example.com",
  "subaddress": "order-4821"
}
```

`recipient` contains the SMTP envelope recipient. `subaddress` contains the text after `+`, without the plus sign.

Generated `@inbound.lettermint.co` addresses do not support plus addressing. They must match the generated address exactly.

## Troubleshooting

<details>
<summary>Why does MX verification fail?</summary>

- Confirm that the MX value is `inbound.lettermint.co`.
- Confirm that the record name matches **Catch-all domain**.
- Include `*.` in the record name for a wildcard domain.
- Check that your DNS provider did not add the domain name twice.
- Wait for DNS caches to update. Then select **Verify** again.
- Check the record with `dig MX replies.example.com` or a similar DNS tool.

</details>

<details>
<summary>Why does the wildcard not receive mail for the base domain?</summary>

This behavior is expected. `*.replies.example.com` matches `tenant.replies.example.com`. It does not match the base domain `replies.example.com`.

Add the exact domain to another inbound route if you must receive mail for the base domain.

</details>

<details>
<summary>Why is mail going to another provider?</summary>

Check all MX records for the receiving domain. Records for multiple providers can send mail to a different provider.

Use a dedicated subdomain to keep inbound routes separate from employee mail and other mailboxes.

</details>

<details>
<summary>Why did a broader wildcard route receive the message?</summary>

Check the configured domains. Lettermint selects the most specific matching wildcard domain.

For example, `*.eu.example.com` takes precedence over `*.example.com`. An exact domain always takes precedence over a wildcard domain.

</details>
