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

# Configure Routes

> Route incoming emails to different destinations based on recipient address

Routes determine what happens when an email arrives at a specific address on your domain. You can forward emails, send them to webhooks, or store them in MailBreeze—and you can configure different routes for different addresses.

## How Routes Work

When MailBreeze receives an inbound email, it evaluates routes in this order:

1. **Exact match** — Does a route exist for this exact address? (e.g., `support@yourdomain.com`)
2. **Catch-all** — Does a wildcard route exist? (e.g., `*@yourdomain.com`)
3. **Default** — Use the domain's default route

If no route matches and no default is configured, the email is stored in the MailBreeze Inbox.

## Route Types

### Email Forwarding

Forward incoming emails to one or more email addresses.

| Setting              | Description                                                     |
| -------------------- | --------------------------------------------------------------- |
| **Forward to**       | Comma-separated list of email addresses                         |
| **Preserve headers** | Keep original From/Reply-To headers (may affect deliverability) |
| **Add prefix**       | Prepend text to subject line (e.g., `[Support]`)                |

**Example configuration:**

```
Address: support@yourdomain.com
Forward to: help@company.com, cto@company.com
Subject prefix: [Customer Support]
```

<Warning>
  Forwarded emails may be flagged by receiving providers due to SPF/DKIM changes. For critical workflows, consider using webhooks instead.
</Warning>

### Webhook Delivery

Send email data to your server as an HTTP POST request.

| Setting                 | Description                                                  |
| ----------------------- | ------------------------------------------------------------ |
| **URL**                 | Your webhook endpoint (must be HTTPS)                        |
| **Secret**              | Shared secret for request signing (optional but recommended) |
| **Include attachments** | Send attachment data inline or as download URLs              |

**Webhook request format:**

```json theme={null}
POST https://your-server.com/webhook/inbound
Content-Type: application/json
X-MailBreeze-Signature: sha256=abc123...

{
  "id": "inb_a1b2c3d4e5f6",
  "from": {
    "address": "sender@example.com",
    "name": "John Doe"
  },
  "to": [
    { "address": "support@yourdomain.com", "name": null }
  ],
  "cc": [],
  "subject": "Help with my account",
  "text": "Plain text content...",
  "html": "<p>HTML content...</p>",
  "attachments": [...],
  "headers": {...},
  "spamScore": 0.1,
  "receivedAt": "2026-01-27T15:30:05.123Z"
}
```

See [Webhook Integration](/inbound/webhooks) for implementation details.

### MailBreeze Inbox

Store emails in MailBreeze for viewing in the dashboard. This is useful for:

* Manual review before automating
* Low-volume addresses
* Compliance archiving
* Backup for webhook failures

Emails are retained for 90 days by default. You can download them as `.eml` files or retrieve via API.

## Create a Route

<Steps>
  <Step title="Navigate to Inbound Settings">
    Go to **Domains** > select your domain > **Inbound Settings** > **Routes**
  </Step>

  <Step title="Click Add Route">
    Click the **Add Route** button to create a new route.
  </Step>

  <Step title="Configure the Route">
    **Address pattern**: Enter the address to match

    * Exact address: `support@yourdomain.com`
    * Catch-all: `*@yourdomain.com` (matches any address)
    * Pattern: `support+*@yourdomain.com` (matches support+anything)

    **Destination**: Select where emails should go

    * Forward to email
    * Send to webhook
    * Store in MailBreeze

    **Options**: Configure destination-specific settings
  </Step>

  <Step title="Save and Test">
    Click **Save** and send a test email to verify the route works correctly.
  </Step>
</Steps>

## Route Examples

### Customer Support System

Route support emails to your helpdesk via webhook:

| Address                  | Destination | Configuration                      |
| ------------------------ | ----------- | ---------------------------------- |
| `support@yourdomain.com` | Webhook     | `https://api.helpdesk.com/inbound` |
| `help@yourdomain.com`    | Webhook     | `https://api.helpdesk.com/inbound` |

### Team Forwarding

Forward department emails to team inboxes:

| Address                | Destination | Forward To                           |
| ---------------------- | ----------- | ------------------------------------ |
| `sales@yourdomain.com` | Email       | `sales-team@company.slack.com`       |
| `hr@yourdomain.com`    | Email       | `hr-team@gmail.com`                  |
| `legal@yourdomain.com` | Email       | `legal@lawfirm.com, ceo@company.com` |

### Reply Tracking

Capture replies to transactional emails:

| Address                  | Destination | Configuration                           |
| ------------------------ | ----------- | --------------------------------------- |
| `reply+*@yourdomain.com` | Webhook     | `https://api.yourapp.com/email-replies` |

The `+*` pattern matches addresses like `reply+order123@yourdomain.com`, allowing you to include metadata in the reply-to address.

### Catch-All with Exceptions

Store most emails, but route specific addresses differently:

| Address                  | Destination      | Priority        |
| ------------------------ | ---------------- | --------------- |
| `support@yourdomain.com` | Webhook          | 1 (exact match) |
| `sales@yourdomain.com`   | Forward          | 2 (exact match) |
| `*@yourdomain.com`       | MailBreeze Inbox | 3 (catch-all)   |

## Multiple Destinations

A single route can send emails to multiple destinations simultaneously:

<Frame>
  <img src="https://mintcdn.com/mailbreeze/Qw2NQJgtGVBjrQaD/images/inbound/multi-destination-route.png?fit=max&auto=format&n=Qw2NQJgtGVBjrQaD&q=85&s=881594755c4b8569f9dda71f2cefa940" alt="Route with multiple destinations" width="1024" height="1024" data-path="images/inbound/multi-destination-route.png" />
</Frame>

This is useful when you want to:

* Archive emails in MailBreeze AND process via webhook
* Forward to multiple team members
* Send to primary webhook with backup forwarding

To configure multiple destinations, click **Add Destination** when creating or editing a route.

## Route Priority

Routes are evaluated from most specific to least specific:

1. **Exact match** — `support@domain.com` beats `*@domain.com`
2. **Pattern match** — `support+*@domain.com` beats `*@domain.com`
3. **Catch-all** — `*@domain.com`
4. **Default route**

If two routes have the same specificity, they're evaluated in the order they were created.

## Disable vs Delete

* **Disable** a route to temporarily stop it without losing configuration
* **Delete** a route to permanently remove it

Disabled routes are skipped during evaluation—emails will fall through to the next matching route or default.

## API Management

You can also manage routes via the API:

```bash Create a route theme={null}
curl -X POST https://api.mailbreeze.com/v1/inbound/routes \
  -H "x-api-key: sk_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "domainId": "dom_abc123",
    "address": "support@yourdomain.com",
    "destinations": [
      {
        "type": "webhook",
        "url": "https://api.yourapp.com/inbound",
        "secret": "whsec_xxx"
      }
    ]
  }'
```

See [API Reference: Inbound Routes](/api-reference/inbound/routes) for full documentation.

## Next Steps

<CardGroup cols={2}>
  <Card title="Webhook Integration" icon="webhook" href="/inbound/webhooks">
    Build your webhook endpoint to process incoming emails
  </Card>

  <Card title="Inbound API" icon="code" href="/api-reference/inbound/list">
    Retrieve and manage inbound emails programmatically
  </Card>
</CardGroup>
