---
title: "Custom Domains for Agent Email: Setup Guide and Best Practices"
description: "A practical guide to setting up custom domains for AI agent email. Why custom domains matter for deliverability, step-by-step DNS configuration, the alias model, and how to avoid common mistakes."
date: "2026-04-08"
author: "myagentmail"
tags: ["custom-domains", "dns", "deliverability", "setup-guide", "email"]
image: "/blog-images/custom-domains-agent-email.png"
---

# Custom Domains for Agent Email: Setup Guide and Best Practices

Your agent's email address matters more than you think. An email from `agent-7f3k@shared-platform.com` feels like spam. An email from `sarah@yourcompany.com` feels like a real person reaching out. Recipients make this judgment in the fraction of a second it takes to glance at the sender field.

Custom domains aren't just about aesthetics. They directly impact deliverability, brand trust, and your ability to maintain sender reputation independently. Here's how to set them up properly.

## Why Custom Domains Matter

### Deliverability

When your agent sends from a shared domain, its sender reputation is pooled with every other user on that domain. If another user sends spam, your agent's emails suffer. With a custom domain, your reputation is yours alone — built by your sending behavior and unaffected by others.

Email providers also treat custom domains more favorably than shared ones. A properly configured custom domain with SPF, DKIM, and DMARC passes all authentication checks, signaling to Gmail, Outlook, and Yahoo that the sender is legitimate.

### Brand Trust

People open emails from senders they recognize. An email from `yourcompany.com` carries the weight of your brand. An email from a generic platform domain doesn't. For agents doing outreach, support, or any customer-facing communication, this recognition drives open rates and reply rates.

### Reputation Independence

If you ever need to switch email providers, your domain comes with you — along with all the sender reputation you've built. Your contacts' email clients have learned to trust `yourcompany.com`. That trust doesn't reset when you change the infrastructure behind it.

## Step-by-Step Setup

### Step 1: Register Your Domain

If you don't already have a domain, register one through any registrar (Namecheap, Cloudflare, Google Domains, Route 53). For agent email, you have two approaches:

**Primary domain:** Use your company's main domain (`yourcompany.com`). This leverages your existing brand recognition and domain age. Best for customer-facing agents.

**Subdomain or separate domain:** Use something like `mail.yourcompany.com` or `yourcompanymail.com`. This isolates your agent email reputation from your main domain. Best for high-volume outreach where you want to protect your primary domain's reputation.

### Step 2: Add the Domain to myagentmail

```bash
curl -X POST https://myagentmail.com/v1/domains \
  -H "X-API-Key: your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "domain": "yourcompany.com"
  }'
```

The response includes the DNS records you need to configure:

```json
{
  "id": "dom_abc123",
  "domain": "yourcompany.com",
  "status": "pending_verification",
  "dnsRecords": [
    {
      "type": "MX",
      "host": "yourcompany.com",
      "value": "mx.myagentmail.com",
      "priority": 10
    },
    {
      "type": "TXT",
      "host": "yourcompany.com",
      "value": "v=spf1 include:_spf.myagentmail.com ~all"
    },
    {
      "type": "CNAME",
      "host": "myagentmail._domainkey.yourcompany.com",
      "value": "myagentmail._domainkey.myagentmail.com"
    },
    {
      "type": "TXT",
      "host": "_dmarc.yourcompany.com",
      "value": "v=DMARC1; p=quarantine; rua=mailto:dmarc@yourcompany.com"
    }
  ]
}
```

### Step 3: Configure DNS Records

Go to your DNS provider and add each record. Here's what each does:

**MX Record:** Routes incoming email to myagentmail's servers. Without this, replies to your agent won't be delivered.

**SPF Record (TXT):** Authorizes myagentmail's servers to send email on behalf of your domain. If you already have an SPF record, add `include:_spf.myagentmail.com` to your existing record rather than creating a second one (you can only have one SPF record per domain).

**DKIM Record (CNAME):** Points to myagentmail's DKIM public key. This enables cryptographic signing of outbound emails, proving they haven't been tampered with.

**DMARC Record (TXT):** Tells receiving servers how to handle emails that fail SPF or DKIM checks.

### Step 4: Verify the Domain

DNS propagation typically takes 5-60 minutes. Once the records are live, trigger verification:

```bash
curl -X POST https://myagentmail.com/v1/domains/dom_abc123/verify \
  -H "X-API-Key: your-api-key"
```

```json
{
  "id": "dom_abc123",
  "domain": "yourcompany.com",
  "status": "verified",
  "spf": "pass",
  "dkim": "pass",
  "dmarc": "pass"
}
```

### Step 5: Create Inboxes on Your Domain

With the domain verified, create inboxes using your custom domain:

```bash
curl -X POST https://myagentmail.com/v1/inboxes \
  -H "X-API-Key: your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "username": "sarah",
    "domain": "yourcompany.com",
    "displayName": "Sarah from YourCompany"
  }'
```

Your agent now sends and receives email as `sarah@yourcompany.com`.

## The Alias Model

myagentmail uses an alias model for custom domains. This means:

- Each inbox has a primary address (the one created with the inbox).
- You can attach custom domain addresses as aliases to existing inboxes.
- When you add a new alias, existing threads and history remain intact — nothing is lost or reset.

This is useful for domain transitions. If you start with a default `@myagentmail.com` address and later add a custom domain, you can attach the new address as an alias without losing conversation history.

```bash
# Add a custom domain alias to an existing inbox
curl -X POST https://myagentmail.com/v1/inboxes/{inbox_id}/aliases \
  -H "X-API-Key: your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "username": "sarah",
    "domain": "yourcompany.com"
  }'
```

## Common Mistakes

### Mistake 1: Creating a Second SPF Record

If your domain already has an SPF record (e.g., from Google Workspace or another service), don't add a second TXT record. Merge the includes:

```
# Wrong — two SPF records
v=spf1 include:_spf.google.com ~all
v=spf1 include:_spf.myagentmail.com ~all

# Right — one merged record
v=spf1 include:_spf.google.com include:_spf.myagentmail.com ~all
```

### Mistake 2: Skipping DMARC

DMARC is often treated as optional. It's not. Gmail, Yahoo, and Outlook increasingly require DMARC for inbox placement. Start with `p=none` if you're unsure, but have the record in place.

### Mistake 3: Not Warming the Domain

A verified domain isn't a warmed domain. If you immediately blast 500 emails from a brand-new domain, deliverability will be poor. Follow a warming schedule — start with 5-10 emails per day to engaged recipients and ramp up over 2-4 weeks.

### Mistake 4: Using Your Primary Domain for Cold Outreach

If your agent does high-volume cold outreach, use a separate domain. A spam complaint on your primary domain affects all email from that domain — including your human team's daily communication. Use something like `reach.yourcompany.com` or `yourcompanyreach.com` to isolate the risk.

## Checking Your Configuration

After setup, verify everything is working:

```bash
# Check domain status and DNS verification
curl https://myagentmail.com/v1/domains/dom_abc123 \
  -H "X-API-Key: your-api-key"
```

You can also use external tools like [MXToolbox](https://mxtoolbox.com) to verify your SPF, DKIM, and DMARC records are published correctly and passing validation.

A properly configured custom domain is the foundation of reliable agent email. It takes 15 minutes to set up and pays dividends in every email your agent sends from that point forward.
