How do I set up a custom domain?
Send emails from your own domain instead of @agentmail.to.
Custom domains let your agent send emails from your brand (e.g., agent@yourcompany.com) instead of the default @agentmail.to. This improves deliverability and builds trust with recipients.
Custom domains are available on the Developer plan and above. The free tier uses @agentmail.to only. See the pricing page for details.
Steps
- Add your domain in the AgentMail Console or via the API
- Add the DNS records AgentMail provides to your DNS provider
- Wait for verification
- Create inboxes on your custom domain
Adding a domain
You can add a domain through the AgentMail Console (go to Domains and click Add Domain) or via the API:
The response includes all the DNS records you need to add at your DNS provider.
DNS records you need to add
AgentMail returns the exact records for your domain in the AgentMail Console and in the records array of the Create Domain response. Always copy the values shown for your domain. For a US-region domain named example.com, the full set looks like this:
- SPF lives on
mail.example.com, not your root domain. AgentMail sends with a custom MAIL FROM subdomain, and SPF is checked against that hostname. Do not add anything to an existing SPF record on your root domain (for example one for Google Workspace or Microsoft 365). - The
mailMX must be the only MX record atmail.example.com. If another MX record exists at that host, verification reportsduplicate_records. This record carries bounces and complaints; it does not receive inbox mail. - DMARC needs a reporting address. If
_dmarc.example.comalready has a DMARC record, keep that single record instead of adding a second one, and make sure it includes arua=mailto:tag. - DKIM needs exactly one TXT record at the selector host. Remove any older record at the same selector.
- Send-only domains: create the domain with
inbound_enabledset tofalseand the receiving MX is left out, so your existing provider keeps receiving mail. - Region: EU-region domains use
eu-central-1in the MX values in place ofus-east-1. - Subdomains: names are relative to your DNS zone. For
agents.example.com, the hosts becomeagents,mail.agents,_dmarc.agents, and<selector>._domainkey.agents. - Optional records: a
linkCNAME is added whentracking_enabledis on, and a wildcard*MX whensubdomains_enabledis on. - Older domains may show three DKIM
CNAMErecords (<token>._domainkeypointing to<token>.dkim.amazonses.com) instead of one DKIM TXT record. Keep them if they already verify.
Legacy orgs should keep existing working DNS records in place. For new domain setup, add the TXT selector records shown in the AgentMail Console or API response.
If you only need to send from your custom domain, create it with inbound_enabled set to false (inboundEnabled: false in TypeScript). AgentMail then leaves the receiving MX out of the records, and your existing email provider keeps receiving mail. On a domain with receiving enabled, the receiving MX is required: verification does not complete without it.
For step-by-step DNS setup instructions, see our provider guides: Cloudflare, GoDaddy, Route 53, Namecheap.
Verifying your domain
After adding DNS records, verify your domain:
You can also verify from the AgentMail Console by navigating to the Domains section and clicking Verify Domain.
Verification status will progress through these stages:
Creating inboxes on your domain
Once verified, you can create inboxes using your custom domain:
To create inboxes on any subdomain of your domain (e.g. support@bot.yourcompany.com) without registering each subdomain separately, enable subdomains on the domain and publish the wildcard MX record it returns.
Tips
- Use a subdomain (e.g.,
agents.yourcompany.com) if you don’t want to modify your root domain’s MX records or risk conflicts with existing email services. See MX record conflicts. - Verification time varies by DNS provider, from a few minutes (Cloudflare, Route 53) to 30 minutes or more (GoDaddy, Namecheap)
- Leave your root SPF record alone: AgentMail’s SPF record goes on
mail.yourcompany.com, not your root domain. Do not addinclude:agentmail.toor any other AgentMail value to an existing SPF record.
For a detailed walkthrough, see the Creating Custom Domains guide.
