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

# Inbound Domains

> Set up an inbound domain with a forwarding URL and MX records to receive incoming email through Lettr for replies, support, and automation workflows

An inbound domain is a domain configured to receive incoming emails through Lettr. By pointing your domain's MX records to Lettr's mail servers and giving Lettr a forwarding URL to deliver each message to, you can capture replies to transactional emails, process incoming support messages, or trigger automated workflows when emails arrive. This is useful for building reply tracking, support ticket systems, or any application that needs to programmatically handle incoming email.

## Why Use Inbound Domains?

Inbound domains let your application participate in two-way email communication:

* **Capture replies**: Feed replies to transactional emails (such as order confirmations or password resets) back into your system
* **Trigger workflows**: Process incoming mail in your handler to create support tickets, update CRM records, or route messages to the right team
* **Real-time delivery**: Every received email is posted to your forwarding URL, so you can react in real time without polling
* **Any address works**: Mail sent to any address at the domain is forwarded, so you can build dedicated inboxes (like `support@inbound.yourcompany.com`) or per-record addresses without creating them first

## How Inbound Email Works

1. A sender emails `support@inbound.yourcompany.com`
2. Their email server looks up MX records for `inbound.yourcompany.com`
3. MX records point to Lettr's mail servers
4. Lettr receives the email
5. Lettr posts the email to your domain's forwarding URL as JSON, including the full raw MIME message

Lettr doesn't score, filter, or store the mail it forwards. Spam checks, routing, and attachment handling happen in your handler.

## Adding an Inbound Domain

### Via Dashboard

**1. Navigate to Inbound Domains**

Go to **Domains** → **Inbound** in your dashboard.

**2. Create the Domain**

Click **Create Inbound Domain** (**New Inbound Domain** once you already have one) and enter your domain name. A subdomain such as `inbound.example.com` is strongly recommended, so your root domain keeps its existing mailbox provider.

**3. Enter a Forwarding URL**

Enter the **Forwarding URL** that should receive mail sent to this domain (a full `http://` or `https://` address), and optionally an **Auth token**. The token is sent to your endpoint in the `X-MessageSystems-Webhook-Token` header so you can verify each request. Click **Create Inbound Domain**.

**4. Add MX Records**

Add the provided MX records to your DNS. These tell email servers to route mail to Lettr. If your DNS is hosted on Cloudflare, you can click **Configure with Cloudflare** on the domain's page to add them automatically.

**5. Verify Domain**

Click **Verify MX Records** on the domain's page to confirm MX record configuration.

> [card] [Try it in the app](https://app.lettr.com/domains/inbound?guide=eyJ2IjoxLCJzdGVwcyI6W3siYW5jaG9yIjoiZG9tYWlucy5pbmJvdW5kLmFkZCIsIm1lc3NhZ2UiOiJBZGQgYW4gaW5ib3VuZCBkb21haW4gc28gTGV0dHIgY2FuIHJlY2VpdmUgaW5jb21pbmcgZW1haWwgYW5kIGZvcndhcmQgaXQgdG8geW91ciBhcHBsaWNhdGlvbi4ifSx7ImFuY2hvciI6ImRvbWFpbnMuaW5ib3VuZC5uYW1lLWlucHV0IiwibWVzc2FnZSI6IlVzZSBhIHN1YmRvbWFpbiBsaWtlIG1haWwuZXhhbXBsZS5jb20gdG8ga2VlcCB5b3VyIHJvb3QgZG9tYWluIG9uIHlvdXIgZXhpc3RpbmcgZW1haWwgcHJvdmlkZXIuIn0seyJhbmNob3IiOiJkb21haW5zLmluYm91bmQudGFyZ2V0LWlucHV0IiwibWVzc2FnZSI6IkVudGVyIHRoZSBVUkwgdGhhdCBzaG91bGQgcmVjZWl2ZSBtYWlsIHNlbnQgdG8gdGhpcyBkb21haW4uIEl0IGlzIHRlc3RlZCB3aGVuIHlvdSBjcmVhdGUgdGhlIGRvbWFpbiBhbmQgbXVzdCBhbnN3ZXIgd2l0aCBhIDJ4eCBzdGF0dXMuIn0seyJhbmNob3IiOiJkb21haW5zLmluYm91bmQuc3VibWl0IiwibWVzc2FnZSI6IkNyZWF0ZSBpdC4gTGV0dHIgdGhlbiBzaG93cyB0aGUgdGhyZWUgTVggcmVjb3JkcyB0byBwb2ludCBhdCBpdHMgbWFpbCBzZXJ2ZXJzLiJ9XSwiZG9jcyI6Imh0dHBzOi8vZG9jcy5sZXR0ci5jb20vbGVhcm4vZG9tYWlucy9pbmJvdW5kLWRvbWFpbnMifQ)
>
> Follow an interactive walkthrough of this guide inside Lettr.

### Forwarding URL Test

The forwarding URL is required and is tested before the domain is created: SparkPost, the mail infrastructure behind Lettr's inbound servers, sends a `POST` request to it and needs a `2xx` response. If your endpoint rejects the test, the dashboard shows the status it returned (for example "Your forwarding URL answered SparkPost with HTTP 403") and the domain is not created. The URL's host must resolve in public DNS to a public IP address. A host that doesn't resolve, usually a typo, or one that points at a private or local address is refused with an explanation on the field.

> [!WARNING]
>
> A firewall or WAF such as Cloudflare commonly blocks the test with a challenge page. Allow server-to-server `POST` requests on your forwarding URL's path. SparkPost publishes no fixed source IP addresses, so verify requests with the auth token rather than an IP allowlist. See [Inbound Security](https://docs.lettr.com/learn/inbound/security.md#verify-the-auth-token).

> [!NOTE]
>
> Inbound domains are managed through the Lettr dashboard. API endpoints for inbound domains are not currently available. The [Lettr MCP server](https://docs.lettr.com/learn/mcp/introduction.md) can list your inbound domains but not create or change them.

> [!TIP]
>
> Want to see what an email looks like when it arrives, before touching your DNS? Every team gets a dedicated [sandbox inbox](https://docs.lettr.com/learn/inbound/sandbox.md): send an email to your sandbox address and inspect it in the dashboard, no MX records required. Sandbox mail is not forwarded to your forwarding URL, so use an inbound domain on a test subdomain to test your endpoint.

## DNS Configuration

Add these MX records to your domain's DNS settings:

| Type | Host/Name | Priority | Value |
| - | - | - | - |
| MX | `@` or subdomain | 10 | `rx1.sparkpostmail.com` |
| MX | `@` or subdomain | 10 | `rx2.sparkpostmail.com` |
| MX | `@` or subdomain | 10 | `rx3.sparkpostmail.com` |

All three records are required.

> [!NOTE]
>
> If using a subdomain like `mail.example.com`, set the Host/Name field to `mail` instead of `@`.

### Understanding MX Priority

All three MX records use the same priority (10), which means email servers will distribute delivery across all three servers equally. If one server is unavailable, senders automatically try the others.

## Verifying Your Inbound Domain

### Via Dashboard

1. Go to **Domains** → **Inbound** and open your domain
2. Click **Verify MX Records**
3. Lettr checks that all MX records are configured correctly

If the domain has no MX records, the failed check tells you where mail sent to it is actually going. A domain without MX records falls back to its A record, so mail is delivered to that host instead of reaching Lettr.

## Inbound Domain Status

Each inbound domain shows one status: either it is receiving mail, or what is missing. The **Inbound Domains** list shows:

| Status | Description |
| - | - |
| **Receiving mail** | MX records are verified and a forwarding URL is set |
| **MX not verified** | MX records are not yet detected or incomplete, so mail never reaches Lettr |
| **No forwarding URL** | Mail that arrives is accepted and then discarded, because there is nowhere to forward it |

A domain can show both problems at once. On the domain's page, the same verdict reads **This domain is receiving mail** or **This domain is not receiving mail yet**, with each missing piece listed.

## Mail Forwarding

Every inbound domain's page has a **Mail Forwarding** card showing where its mail is delivered. Use it to add or change the **Forwarding URL** and **Auth token**, then click **Save forwarding URL**. The new URL is tested before it is saved. Leave **Auth token** blank to keep the token already set.

> [!NOTE]
>
> Inbound domains created before forwarding URLs were required have none, so their mail is accepted and then discarded. Their **Mail Forwarding** card shows **Not configured** until you add a URL.

## Using Subdomains

We recommend using a subdomain for inbound email to separate it from your main domain's email:

| Configuration | Use Case |
| - | - |
| `mail.example.com` | General inbound processing |
| `reply.example.com` | Reply tracking for transactional emails |
| `support.example.com` | Customer support emails |
| `inbound.example.com` | Automated workflow triggers |

> [!TIP]
>
> Using subdomains lets you keep your root domain's MX records pointing to your regular email provider (Gmail, Microsoft 365, etc.) while routing specific addresses through Lettr.

## Processing Inbound Emails

### Forwarding URL Payload

Each email sent to the domain is posted to your forwarding URL as a JSON array of events (one request can carry more than one email), each holding an `msys.relay_message` object:

```json theme={null}
[
  {
    "msys": {
      "relay_message": {
        "msg_from": "sender@external.com",
        "rcpt_to": "support@mail.example.com",
        "friendly_from": "Sender <sender@external.com>",
        "content": {
          "subject": "Question about my order",
          "text": "Hello, I have a question...",
          "html": "<p>Hello, I have a question...</p>",
          "headers": [
            { "Message-ID": "<abc123@external.com>" },
            { "Date": "Mon, 15 Jan 2024 10:30:00 +0000" }
          ],
          "to": ["support@mail.example.com"],
          "email_rfc822": "...raw MIME content...",
          "email_rfc822_is_base64": false
        }
      }
    }
  }
]
```

Attachments are not sent as separate fields. They are inside the raw message in `email_rfc822`, which you parse with a MIME library. If you set an auth token, it arrives in the `X-MessageSystems-Webhook-Token` header. See [Email Parsing](https://docs.lettr.com/learn/inbound/parsing.md) for a breakdown of each field and [Attachments](https://docs.lettr.com/learn/inbound/attachments.md) for extracting files.

## Delete an Inbound Domain

> [!WARNING]
>
> Deleting an inbound domain stops forwarding: mail sent to addresses on this domain no longer reaches your forwarding URL. This cannot be undone. Remove or repoint the domain's MX records if you no longer use it.

### Via Dashboard

1. Go to **Domains** → **Inbound**
2. Find the domain and click its delete (trash) icon
3. Type the domain name to confirm, then click **Delete Inbound Domain**

## Use Cases

### Reply Tracking

Capture replies to transactional emails:

1. Set up `reply.example.com` as an inbound domain
2. Send emails with `reply_to: reply+{ticket_id}@reply.example.com`
3. Receive the reply at your forwarding URL when the customer replies
4. Read the ticket ID from the recipient address (`rcpt_to`) to match the original email

See [Reply Tracking](https://docs.lettr.com/learn/inbound/reply-tracking.md) for the full pattern.

### Support Ticketing

Create a support email system:

1. Set up `support.example.com` as an inbound domain
2. Point its forwarding URL at your ticketing endpoint
3. Create tickets in your system from email content
4. Use the `Message-ID`, `In-Reply-To`, and `References` headers to track conversation threads

### Data Extraction

Extract structured data from incoming emails:

1. Receive order confirmations, receipts, or notifications
2. Read the content posted to your forwarding URL (`text`, `html`, or the raw `email_rfc822`)
3. Extract relevant data in your handler and store it in your database

## Troubleshooting

> [accordion] MX records not verified
>
> * DNS changes can take up to 48 hours to propagate
> * Verify all three MX records are added with correct priorities
> * Use a tool like [MXToolbox](https://mxtoolbox.com/) to check your MX records
> * Ensure no conflicting MX records exist

> [accordion] Emails not being received
>
> * Confirm the domain shows **Receiving mail** in the dashboard. If it shows **No forwarding URL**, add one on the domain's **Mail Forwarding** card.
> * Verify your forwarding URL is reachable and returns a `2xx` status
> * Check that your firewall or WAF isn't blocking server-to-server `POST` requests to the forwarding URL
> * Lettr doesn't filter inbound mail, so check your handler's logs for requests it received but rejected, discarded, or failed to process

> [accordion] Forwarding URL rejected when creating the domain
>
> * The dashboard shows the HTTP status your endpoint returned to the test request, and the domain is not created
> * Make sure the endpoint accepts `POST` requests and returns a `2xx` status
> * Check the hostname for typos. It must resolve in public DNS to a public IP address; private and local addresses such as `localhost` or `192.168.x.x` aren't allowed
> * If it sits behind Cloudflare or another WAF, allow server-to-server `POST` requests on that path
> * SparkPost publishes no fixed source IPs, so don't rely on an IP allowlist. Use the auth token instead.

> [accordion] Partial MX records detected
>
> * All three MX servers must be configured
> * Check for typos in server hostnames
> * Ensure all three records have priority 10

> [accordion] Conflict with existing email provider
>
> * Use a subdomain instead of your root domain
> * You can only have one set of MX records per domain/subdomain
> * Consider using `mail.example.com` while keeping `example.com` with your current provider

## Best Practices

1. **Use subdomains** - Keep inbound separate from your main email
2. **Test your forwarding URL early** - Make sure your endpoint receives inbound mail before going live
3. **Handle attachments carefully** - Validate and scan files you extract from `email_rfc822`
4. **Handle spam yourself** - Lettr doesn't filter inbound mail, so add your own checks in your handler
5. **Test with multiple senders** - Verify emails arrive from various email providers

## Related Topics

> [card] [Sending Domains](https://docs.lettr.com/learn/domains/sending-domains.md)
>
> Configure domains for sending

> [card] [Inbound Setup](https://docs.lettr.com/learn/inbound/setup.md)
>
> Forwarding URL and MX setup step by step

> [card] [Inbound](https://docs.lettr.com/learn/inbound/introduction.md)
>
> Learn about inbound email

> [card] [Tracking Domains](https://docs.lettr.com/learn/domains/tracking-domains.md)
>
> Custom tracking domains


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.