> For clean Markdown content of this page, append .md to this URL. For the complete documentation index, see https://docs.postnuvia.com/llms.txt.

# How do I avoid MX record conflicts?

If you already use Gmail, Outlook, or another email provider for your domain, adding PostNuvia's MX records could conflict with your existing setup. Here is how to avoid that.

## Use a subdomain

The simplest and recommended approach: set up PostNuvia on a subdomain instead of your root domain.

| Domain                   | Used by                     | No conflict         |
| ------------------------ | --------------------------- | ------------------- |
| `yourcompany.com`        | Gmail / Outlook (your team) | Unchanged           |
| `agents.yourcompany.com` | PostNuvia (your agents)     | Separate MX records |

Your agents send and receive from addresses like `support@agents.yourcompany.com`, while your team keeps using `name@yourcompany.com`. Both work independently with no overlap.

## How to set it up

When adding your domain in PostNuvia, use the subdomain:

**`TypeScript`**

```typescript title="TypeScript"
import { PostNuviaClient } from "postnuvia";

const client = new PostNuviaClient({ apiKey: "am_..." });

// use a subdomain to avoid MX conflicts
const domain = await client.domains.create("agents.yourcompany.com");

// create inboxes on the subdomain
const inbox = await client.inboxes.create({
  username: "support",
  domain: "agents.yourcompany.com",
  displayName: "Support Agent",
});
// inbox address: support@agents.yourcompany.com
```

Then add the MX, SPF, and DKIM records for `agents.yourcompany.com` at your DNS provider. These records are completely separate from your root domain's records and will not affect your existing email.

## Hosting inboxes on many subdomains

The setup above puts all your agents on one subdomain. If you instead want inboxes spread across **many** subdomains (for example, one per team or customer), [enable subdomains](/custom-domains#setting-up-subdomains) on the domain you registered. With them enabled on `agents.yourcompany.com`, publishing a single wildcard MX record (`*.agents.yourcompany.com`) lets you create inboxes on any nested subdomain, such as `support@team1.agents.yourcompany.com`, without registering each one. Your root domain's email is never touched.

## Can I use my root domain?

Yes, but only in these scenarios:

**Sending only (no receiving):** If you only need PostNuvia to send emails from your root domain, you only need SPF, DKIM, and DMARC TXT records. These do not conflict with existing MX records, so your Gmail or Outlook inbound mail is unaffected.

**Full PostNuvia (sending and receiving):** If you want PostNuvia to also receive emails on your root domain, you would need to replace your existing MX records with PostNuvia's. This means all incoming mail for that domain routes to PostNuvia instead of Gmail or Outlook. Only do this if you want PostNuvia to handle all inbound email for that domain.

## Example DNS setup

**Before (Gmail only):**

```text
yourcompany.com    MX    10    aspmx.l.google.com.
yourcompany.com    MX    20    alt1.aspmx.l.google.com.
```

**After (Gmail on root + PostNuvia on subdomain):**

```text
yourcompany.com            MX    10    aspmx.l.google.com.
yourcompany.com            MX    20    alt1.aspmx.l.google.com.
agents.yourcompany.com     MX    10    inbound.postnuvia.com.
agents.yourcompany.com     TXT         v=spf1 include:postnuvia.com ~all
selector._domainkey.agents.yourcompany.com TXT (DKIM value from PostNuvia)
```

> **Note**
>
> Legacy orgs should keep existing working DNS records in place. For new domain setup, add the TXT selector records shown in PostNuvia.

Your team's email continues to flow through Gmail. Agent emails go through PostNuvia. Clean separation with no conflicts.

## Common subdomain choices

| Subdomain                | Example address                  |
| ------------------------ | -------------------------------- |
| `agents.yourcompany.com` | `support@agents.yourcompany.com` |
| `mail.yourcompany.com`   | `outreach@mail.yourcompany.com`  |
| `ai.yourcompany.com`     | `assistant@ai.yourcompany.com`   |

Pick whatever makes sense for your brand. The important thing is that it is a separate subdomain from your root domain's email.