When you start sending email from a new domain, the receiving mail server has one question: is this message really from who it says it is? SPF, DKIM and DMARC are how you answer. They are three kinds of DNS record, each checking something different, and together they decide whether your mail is trusted, filtered or rejected. Gmail, Yahoo and Outlook.com now require them from anyone sending at volume. This guide explains what each record does, shows example records, and covers the part most setups get wrong: alignment.
What each record checks
It helps to know that an email has two sender addresses. The envelope sender (also called MAIL FROM or Return-Path) is used between servers and is where bounces go. The header From is the address the recipient sees. The three standards check different parts.
| Record | What it checks | Which domain | Where it lives |
|---|---|---|---|
| SPF | Was this message sent by a server the domain allows? | Envelope sender (Return-Path) | TXT on the envelope domain |
| DKIM | Was the message signed by the domain, and unchanged since? | The d= domain in the signature | TXT or CNAME at selector._domainkey |
| DMARC | Did SPF or DKIM pass for a domain matching the visible From? | Header From | TXT at _dmarc |
SPF and DKIM on their own say nothing about the address the reader sees. DMARC is what ties them to it. That link is called alignment, and it is why a message can pass SPF and DKIM and still fail DMARC.
SPF: who may send
SPF (RFC 7208) is a TXT record listing the servers allowed to send mail with a given envelope domain. A receiving server looks up the domain in the Return-Path, checks whether the connecting IP is on the list, and records pass or fail.
A typical SPF record for a domain that also uses a workspace provider for staff mail:
example.com. TXT "v=spf1 include:_spf.workspace-provider.example ~all"A few rules worth knowing:
- One SPF record per name. Two
v=spf1records on the same name cause a permanent error and SPF fails. Merge them. - Ten DNS lookups at most. Each
include,a,mxandredirectcounts, including those nested inside includes. Go over ten and SPF fails. Moving a sender to its own subdomain is the cleanest way to stay under. ~allor-all.~all(soft fail) is the common choice while you set things up;-all(fail) is stricter. With DMARC in place, the DMARC policy matters more than the SPF qualifier.- Domains that never send should say so, which stops others spoofing them:
"v=spf1 -all".
The important limitation: SPF checks the envelope sender only. If your email platform uses its own domain as the Return-Path, SPF passes for the platform's domain, not yours.
DKIM: a signature on every message
DKIM (RFC 6376) adds a signature header to each message. The sending platform signs with a private key; you publish the matching public key in DNS under a selector. The receiver reads the d= domain and selector from the signature, fetches the key from selector._domainkey.d-domain and verifies that the signed headers and body have not changed.
Providers publish DKIM keys in one of two ways. Some give you the key itself as a TXT record:
s1._domainkey.example.com. TXT "v=DKIM1; k=rsa; p=MIIBIjANBgkqh...IDAQAB"Others give you CNAME records pointing at keys they host, which lets them rotate keys without you editing DNS:
selector1._domainkey.example.com. CNAME selector1.dkim.provider.example.selector2._domainkey.example.com. CNAME selector2.dkim.provider.example.Either way, the value comes from your provider; copy it exactly. Use 2048-bit keys where you have the choice. Long TXT values are sometimes split into several quoted strings by the DNS provider, which is fine as long as nothing is lost in the copy.
What matters for DMARC is that the signature's d= is your domain (or a subdomain of it), not the platform's. Most platforms do this once you verify your domain with them.
The custom MAIL FROM subdomain
Here is the gap DKIM leaves. Your mail is signed with d=example.com, so DKIM aligns. But by default the envelope sender is something like bounces.provider.example, so SPF passes for the provider's domain and does not align with your From address. DMARC still passes, on DKIM alone. That works until something breaks the DKIM signature — a forwarder that edits the subject, a mailing list that adds a footer — and then there is no aligned SPF to fall back on.
A custom MAIL FROM subdomain closes the gap. You choose a subdomain of your own, such as mail.example.com, and the platform uses it as the envelope sender. You publish two records on it:
mail.example.com. MX 10 feedback.provider.example.mail.example.com. TXT "v=spf1 include:spf.provider.example ~all"The MX record means bounces and feedback for that subdomain go to the platform, which processes them for you. The TXT record authorises the platform's servers for SPF. Now SPF passes for mail.example.com, which shares the organisational domain example.com with your From address. Under DMARC's default relaxed alignment, that counts as aligned.
The result is two independent aligned passes. If a forwarder breaks DKIM, SPF can still carry DMARC (and the reverse, since SPF usually breaks on forwarding while DKIM survives it).
DMARC: tying it together
DMARC (RFC 7489) is a TXT record at _dmarc on your domain. It tells receivers two things: what to do with mail that fails, and where to send reports.
_dmarc.example.com. TXT "v=DMARC1; p=none; rua=mailto:dmarc-reports@example.com; adkim=r; aspf=r"The tags you will use:
p— the policy:none(monitor only),quarantine(treat as suspicious, usually spam folder) orreject.rua— where aggregate reports go. These daily XML reports list every source sending as your domain and whether it passed.sp— a separate policy for subdomains, if you want one. Without it, subdomains inheritp.pct— apply the policy to only a percentage of failing mail, useful when stepping up.adkimandaspf—r(relaxed, the default) lets a subdomain align with its parent;s(strict) needs an exact match. Relaxed is right for almost everyone, and it is what makes the MAIL FROM subdomain work.
A message passes DMARC if either SPF or DKIM passes and aligns with the header From domain.
A safe path to p=reject
Starting at p=reject on a domain that already sends mail is how invoices from your accounting tool start vanishing. Go in stages.
- Publish
p=nonewithrua. Nothing changes for delivery; you start receiving reports. This alone meets the Gmail, Yahoo and Outlook.com requirement. - Read the reports for two to four weeks. Aggregate reports are XML and hard to read raw; a free or paid DMARC report viewer helps. Look for legitimate sources that fail — a CRM, a helpdesk, a billing system — and fix their SPF or DKIM.
- Move to
p=quarantine. Optionally start withpct=25and raise it. - Move to
p=rejectonce quarantine has run cleanly for a while.
The step to enforcement is what actually stops spoofing of your domain. p=none meets the requirement, but it does not protect anyone.
Checking that it works
After publishing, verify before you send anything important. Start with DNS lookups; dig shows what the rest of the world sees:
dig +short TXT _dmarc.example.comdig +short TXT mail.example.comdig +short MX mail.example.comdig +short CNAME selector1._domainkey.example.comThen check the result end to end:
- A test message. Send to a Gmail address you own, open it and choose "Show original". You want
SPF: PASS,DKIM: PASSandDMARC: PASS, with your domain named in each. - Common mistakes. DNS providers that append the domain automatically, turning
_dmarc.example.cominto_dmarc.example.com.example.com; a missing character in a long DKIM value; a second SPF record left behind by an old provider.
Doing this with Rampsend
When you add a domain in Rampsend under Deliverability → Domains, the app shows the records to publish: DKIM records so your mail is signed with your domain, the MX and TXT records for a custom MAIL FROM subdomain so SPF aligns, and a DMARC record. Copy the values from the app rather than from any example — the ones in this post are placeholders.
If you work with an AI assistant, it can do the checking for you. Connected over MCP, it can call check_domain and tell you which record is missing or wrong, and with a Full access API key it can start the setup with add_domain. The MCP guide lists the tools, and letting an AI agent send email covers the safeguards.
Next steps
Authentication gets you through the door; reputation decides what happens next. With the records in place, work through the Gmail, Yahoo and Outlook sender requirements, then build volume gradually with a warm-up plan for a new sending domain. The quickstart takes you from verified domain to first send.
Frequently asked questions
Do I need all three, or is DKIM enough?
DMARC passes with either SPF or DKIM aligned, so DKIM alone can be enough for DMARC. Gmail and Yahoo require bulk senders to have both SPF and DKIM, though, and having both means one can cover for the other when mail is forwarded.
Can I have two SPF records on the same domain?
No. A name can have only one SPF record; two cause a permerror and SPF fails. Merge them into one record, or move one sender to its own subdomain.
What does a custom MAIL FROM subdomain do?
It makes the envelope sender (Return-Path) a subdomain of your own domain, such as mail.example.com, instead of your provider's domain. SPF then passes for your domain and aligns with your From address under relaxed DMARC alignment.
How long should I stay on p=none?
Until your aggregate reports show every legitimate source passing, which usually takes a few weeks. Then move to p=quarantine, optionally with pct below 100, and on to p=reject.
Why does my DNS check still fail after I added the records?
Usually a copy mistake: the host name doubled by the DNS provider (_dmarc.example.com.example.com), a missing character in a long value, or a record added at the wrong level. DNS changes can also take time to propagate, depending on the TTL.



