Prompt
How do I authenticate a domain for sending from multiple subdomains?
Latest observation
To authenticate a domain for sending from multiple subdomains, you typically want to set up SPF, DKIM, and DMARC in a way that covers both the parent domain and each subdomain you’ll send from.
1) SPF
SPF is checked against the envelope-from / return-path domain, so it needs to authorize the sending service for each domain/subdomain used in that role.
Common approaches
- If all subdomains use the same mail provider:
You can often publish SPF on the root domain and/or each subdomain. - If different subdomains send through different services:
Each subdomain should have its own SPF record tailored to that sender.
Example
If:
example.comsends via Google Workspacenews.example.comsends via Mailchimpalerts.example.comsends via SendGrid
Then you might have:
example.com TXT "v=spf1 include:_spf.google.com -all"news.example.com TXT "v=spf1 include:servers.mcsv.net -all"alerts.example.com TXT "v=spf1 include:sendgrid.net -all"
Note: You should only have one SPF TXT record per hostname. If needed, combine mechanisms into a single record.
2) DKIM
DKIM should be enabled for each sending domain/subdomain.
Best practice
- Create a DKIM selector/key for each domain or subdomain you send from.
- Sign messages with the From: domain or a related subdomain.
Example
A message sent from:
support@example.comcan be DKIM-signed asd=example.compromo@news.example.comcan be DKIM-signed asd=news.example.com
This is often the cleanest way to authenticate multiple subdomains.
3) DMARC
DMARC is where you define policy and reporting for the domain hierarchy.
Important point
DMARC is evaluated on the From: header domain.
So:
- mail from
user@example.comis governed byexample.com - mail from
user@news.example.comis governed bynews.example.com
If you want one policy for all subdomains
Set a DMARC record at the parent domain with the sp tag:
_dmarc.example.com TXT "v=DMARC1; p=quarantine; sp=quarantine; rua=mailto:dmarc-reports@example.com"
p=applies to the organizational domainsp=applies to subdomains
If subdomains need their own policies
You can also publish separate DMARC records for each subdomain:
_dmarc.news.example.com TXT "v=DMARC1; p=reject; rua=mailto:news-dmarc@example.com"
_dmarc.alerts.example.com TXT "v=DMARC1; p=quarantine; rua=mailto:alerts-dmarc@example.com"
If a subdomain has its own DMARC record, that record overrides the parent’s sp= policy for that subdomain.
Recommended setup for multiple subdomains
If you control all sending subdomains, a common robust setup is:
- Root domain SPF
- Separate SPF for each sending subdomain if they use different providers
- DKIM signing per subdomain
- DMARC at the root with
sp= - Optional: separate DMARC records for subdomains with special handling
Example:
example.com TXT "v=spf1 include:_spf.google.com -all"
news.example.com TXT "v=spf1 include:servers.mcsv.net -all"
alerts.example.com TXT "v=spf1 include:sendgrid.net -all"
_dmarc.example.com TXT "v=DMARC1; p=reject; sp=quarantine; rua=mailto:dmarc@example.com"
Key rule to remember
For best deliverability, each message should have:
- SPF pass for the sending domain
- DKIM pass with alignment to the visible
From:domain or its organizational domain - DMARC pass for the
From:domain
If you want, I can also give you:
- a DNS record template for your exact providers, or
- a step-by-step setup for Gmail/Google Workspace, Microsoft 365, SendGrid, Mailchimp, etc.