> ## 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 MX records to receive incoming email through Lettr, capturing replies and triggering webhooks for 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, 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** — Parse and process incoming mail to create support tickets, update CRM records, or route messages to the right team
* **Real-time events** — Every received email generates a webhook event, so you can react in real time without polling
* **Forwarding and routing** — Forward incoming emails to other addresses or build dedicated support inboxes (like `support@yourcompany.com`) that integrate directly with your internal tools

## How Inbound Email Works

1. A sender emails `support@yourcompany.com`
2. Their email server looks up MX records for `yourcompany.com`
3. MX records point to Lettr's mail servers
4. Lettr receives the email and processes it
5. You receive a webhook or access the email via API

## Adding an Inbound Domain

### Via Dashboard

<Steps>
  <Step title="Navigate to Inbound Domains">
    Go to **Domains** → **Inbound** in your dashboard.
  </Step>

  <Step title="Add Domain">
    Click **Add Domain** and enter your domain name (e.g., `example.com` or `mail.example.com`).
  </Step>

  <Step title="Add MX Records">
    Add the provided MX records to your DNS. These tell email servers to route mail to Lettr.
  </Step>

  <Step title="Verify Domain">
    Click **Verify** to confirm MX record configuration.
  </Step>
</Steps>

<Card title="Try it in the app" icon="wand-magic-sparkles" href="https://app.lettr.com/domains/inbound?guide=eyJ2IjoxLCJzdGVwcyI6W3siYW5jaG9yIjoiZG9tYWlucy5pbmJvdW5kLmFkZCIsIm1lc3NhZ2UiOiJBZGQgYW4gaW5ib3VuZCBkb21haW4gc28gTGV0dHIgY2FuIHJlY2VpdmUgaW5jb21pbmcgZW1haWwgYW5kIGZpcmUgd2ViaG9va3MgZm9yIGl0LiJ9LHsiYW5jaG9yIjoiZG9tYWlucy5pbmJvdW5kLm5hbWUtaW5wdXQiLCJtZXNzYWdlIjoiVXNlIGEgc3ViZG9tYWluIGxpa2UgbWFpbC5leGFtcGxlLmNvbSB0byBrZWVwIHlvdXIgcm9vdCBkb21haW4gb24geW91ciBleGlzdGluZyBlbWFpbCBwcm92aWRlci4ifSx7ImFuY2hvciI6ImRvbWFpbnMuaW5ib3VuZC5zdWJtaXQiLCJtZXNzYWdlIjoiQWRkIGl0LiBMZXR0ciB0aGVuIHNob3dzIHRoZSB0aHJlZSBNWCByZWNvcmRzIHRvIHBvaW50IGF0IGl0cyBtYWlsIHNlcnZlcnMuIn1dLCJkb2NzIjoiaHR0cHM6Ly9kb2NzLmxldHRyLmNvbS9sZWFybi9kb21haW5zL2luYm91bmQtZG9tYWlucyJ9">
  Follow an interactive walkthrough of this guide inside Lettr.
</Card>

<Note>
  Inbound domains are managed through the Lettr dashboard. API endpoints for inbound domains are not currently available.
</Note>

## 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` |

<Note>
  If using a subdomain like `mail.example.com`, set the Host/Name field to `mail` instead of `@`.
</Note>

### 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**
2. Find your domain and click **Verify**
3. Lettr checks that all MX records are configured correctly

## Inbound Domain Status

| Status       | Description                                   |
| ------------ | --------------------------------------------- |
| `valid`      | All MX records found and configured correctly |
| `unverified` | MX records not yet detected or incomplete     |

## 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                 |
| `bounce.example.com`  | Bounce processing                       |

<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.
</Tip>

## Processing Inbound Emails

Once your inbound domain is configured, you can process incoming emails in several ways:

### Webhooks

Set up a webhook to receive notifications when emails arrive:

```json theme={null}
{
  "event": "inbound",
  "timestamp": "2024-01-15T10:30:00Z",
  "data": {
    "from": "sender@external.com",
    "to": ["support@mail.example.com"],
    "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"
    },
    "attachments": [
      {
        "filename": "screenshot.png",
        "content_type": "image/png",
        "size": 15234
      }
    ]
  }
}
```

See [Webhooks](/learn/webhooks/introduction) for setup instructions.

## Delete an Inbound Domain

<Warning>
  Deleting an inbound domain will stop email delivery to that domain. Emails sent to addresses on this domain will bounce.
</Warning>

### Via Dashboard

1. Go to **Domains** → **Inbound**
2. Find the domain and click **Delete**
3. Confirm deletion

## 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 webhook when customer replies
4. Parse the reply address to match the original email

### Support Ticketing

Create a support email system:

1. Set up `support.example.com` as an inbound domain
2. Configure webhook to receive incoming emails
3. Create tickets in your system from email content
4. Use metadata to track conversation threads

### Email Parsing

Extract structured data from incoming emails:

1. Receive order confirmations, receipts, or notifications
2. Parse email content using webhooks
3. Extract relevant data and store in your database

## Troubleshooting

<AccordionGroup>
  <Accordion title="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>

  <Accordion title="Emails not being received">
    * Confirm MX status is `valid` in the dashboard
    * Check that the sender's email isn't being blocked
    * Verify webhook endpoint is configured and accessible
    * Check spam filters at the sending server
  </Accordion>

  <Accordion title="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>

  <Accordion title="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
  </Accordion>
</AccordionGroup>

## Best Practices

1. **Use subdomains** - Keep inbound separate from your main email
2. **Set up webhooks early** - Ensure you're receiving inbound notifications before going live
3. **Handle attachments carefully** - Validate and sanitize uploaded files
4. **Monitor for spam** - Implement filtering for inbound messages
5. **Test with multiple senders** - Verify emails arrive from various email providers

## Related Topics

<CardGroup cols={2}>
  <Card title="Sending Domains" icon="paper-plane" href="/learn/domains/sending-domains">
    Configure domains for sending
  </Card>

  <Card title="Webhooks" icon="webhook" href="/learn/webhooks/introduction">
    Set up inbound email webhooks
  </Card>

  <Card title="Inbound" icon="inbox" href="/learn/inbound/introduction">
    Learn about inbound email
  </Card>

  <Card title="Tracking Domains" icon="chart-line" href="/learn/domains/tracking-domains">
    Custom tracking domains
  </Card>
</CardGroup>
