SPF, DKIM and DMARC for SaaS: A Setup Guide
Three DNS records decide whether your receipts, password resets and newsletters reach the inbox. Here is what each one checks, how to set them up across every tool that sends as your domain, and how to tighten DMARC without blocking your own mail.
SaaS Lifecycle Signal guide · Last reviewed
What each record does
SPF, DKIM and DMARC are three DNS records that let a receiving mail server check that a message really comes from the domain it claims. They answer different questions, and a SaaS company needs all three: Gmail, Yahoo and Outlook.com now require them from anyone sending in volume.
| Record | Where it lives | What it checks | What breaks it |
|---|---|---|---|
| SPF | TXT record on the sending domain, e.g. example.com | That the server handing over the message is allowed to send for the envelope sender (Return-Path) domain | Forwarding, a second SPF record, more than 10 DNS lookups |
| DKIM | TXT or CNAME at selector._domainkey.example.com | A cryptographic signature over the message headers and body, made with a key only the sender holds | Anything that rewrites the signed headers or body in transit; a provider signing with its own domain instead of yours |
| DMARC | TXT record at _dmarc.example.com | That SPF or DKIM passed for a domain matching the visible From address, and what to do when neither did | Senders you forgot to authenticate, once the policy moves past p=none |
The detail that trips most teams up is alignment. SPF and DKIM can both pass while DMARC fails, because a pass only counts for DMARC when the authenticated domain matches the domain in the From header your customers see. An email provider that sends from its own bounce domain and signs with its own DKIM key will pass SPF and DKIM for itself, not for you.
Before you touch DNS: list everything that sends as you
A SaaS domain rarely has one sender. Before writing a single record, list every system that puts your domain in the From address. Anything missing from this list will fail DMARC later, and once the policy is enforced, its mail stops arriving.
- The transactional provider your app calls for sign-up confirmations, password resets, login links and receipts.
- The marketing or broadcast tool for newsletters, product announcements and lifecycle sequences.
- Staff mailboxes: Google Workspace or Microsoft 365.
- Support and helpdesk tools that reply from addresses like
support@. - Billing and invoicing systems that email receipts and dunning notices as your domain.
- CRM and sales outreach tools, and any AI agent or automation that sends on your behalf.
Then decide which domain each stream sends from. A common pattern is to keep staff mail on the root domain and give product mail and marketing mail their own subdomains, such as notify.example.com and news.example.com. Each subdomain gets its own SPF and DKIM records and builds its own reputation, so a marketing campaign that draws complaints does not drag down password resets.
Step 1: Publish one SPF record per sending domain
SPF is a single TXT record listing the servers allowed to send for a domain. Each provider gives you an include: value to add; Google Workspace's is _spf.google.com. Copy the others from each provider's domain settings page rather than from a blog post, because they change.
v=spf1 include:_spf.google.com include:[your-provider's-spf-include] ~all- One SPF record per hostname. Two records starting with
v=spf1on the same name is a permanent error, and receivers treat SPF as failed. When you add a tool, merge its include into the existing record. - Ten DNS lookups at most. Every
include,a,mx,ptr,existsandredirectcounts, including the lookups nested inside each provider's include. Go over and SPF fails for every message. Moving streams onto subdomains is the cleanest way to stay under the limit. ~all(softfail) or-all(fail) at the end. Once DMARC is enforced, DMARC policy decides what happens to failing mail, so~allis a common and safe choice.- SPF checks the Return-Path (envelope sender) domain, not the From address. For SPF to align for DMARC, set a custom return-path or bounce domain in your provider, usually a CNAME such as
bounce.notify.example.compointing at the provider.
A domain or subdomain that never sends mail should say so: publish v=spf1 -all on it so nobody can pass SPF while spoofing it.Step 2: Turn on DKIM signing with your own domain
With DKIM, the sending service signs each message with a private key, and you publish the matching public key in DNS under a selector the provider chooses. Every provider that sends as your domain needs its own selector and key; they sit side by side without conflict.
[selector1]._domainkey.notify.example.com CNAME [value from your transactional provider]
[selector2]._domainkey.news.example.com CNAME [value from your marketing tool]
google._domainkey.example.com TXT v=DKIM1; k=rsa; p=[public key from the Google Admin console]- Complete the provider's domain authentication step, not just the sending setup. Until you do, many providers sign with their own domain (
d=provider.com), which passes DKIM but cannot align with your From address. - Use 2048-bit keys where your DNS host supports them. Google requires at least 1024 bits for mail to personal Gmail accounts and recommends 2048.
- Prefer CNAME records when a provider offers them: the provider can then rotate keys without you editing DNS.
- DKIM survives forwarding where SPF does not, as long as nothing rewrites the signed content. That makes aligned DKIM the more dependable of the two for DMARC.
Step 3: Publish DMARC at p=none and read the reports
DMARC ties the other two to your From address and tells receivers what to do when a message fails. Start in monitoring mode: p=none changes nothing about delivery, but receivers begin sending aggregate reports showing every source that sends as your domain and whether it passed.
v=DMARC1; p=none; rua=mailto:dmarc-reports@example.com| Tag | What it sets | Typical value |
|---|---|---|
p | Policy for mail that fails DMARC on this domain | none, then quarantine, then reject |
rua | Where aggregate (daily, XML) reports go | A mailbox or a DMARC reporting service |
sp | Policy for subdomains without their own DMARC record | Defaults to p when left out |
adkim / aspf | Relaxed (r) or strict (s) alignment for DKIM and SPF | Relaxed, the default, lets notify.example.com align with example.com |
pct | Share of failing mail the policy applies to | Ramp from a small share to 100 when tightening |
- Aggregate reports are XML files, sent roughly daily by each receiver. A reporting service turns them into a list of sources; at any real volume, reading them by hand is impractical.
- Sending reports to an address on another domain requires that domain to publish an authorization record (
example.com._report._dmarc.reports-domain.com). Reporting services set this up for you. - Subdomains without their own
_dmarcrecord inherit the organizational domain's policy throughsp, orpwhenspis absent.
Step 4: Move from p=none to p=reject
p=none meets the minimum bulk-sender requirements, but it does not stop anyone spoofing your domain. The protection comes from enforcement, and the risk of enforcement is blocking your own legitimate mail. Move up in stages, and only when the reports show every legitimate source passing with alignment.
- Run
p=noneuntil the reports cover a full business cycle, including monthly billing runs and any quarterly campaigns, so that rare senders show up. - Fix every legitimate source that fails: add its SPF include, finish its DKIM setup, or move it to a subdomain you can authenticate.
- Switch to
p=quarantine, optionally with apctbelow 100 to apply it to part of the failing mail first. Failing messages go to spam instead of being rejected. - Keep reading reports. When failures are only spoofing and forwarding noise, move to
p=reject. - Make DNS part of onboarding any new sending tool. After
p=reject, a tool added without DKIM is simply blocked.
There is no standard timeline; how fast you move depends on how many senders you have and how quickly you can fix them. Domains you own but never send from can go straight to p=reject alongside v=spf1 -all.
What Gmail, Yahoo and Outlook.com require
The large mailbox providers turned these records from best practice into a condition of delivery. The rules below are a summary; thresholds and enforcement change, so check each provider's own page (linked in the sources) before relying on them.
| Provider | Applies to | Authentication required |
|---|---|---|
| Gmail | All senders; stricter rules from February 1, 2024 for senders of more than 5,000 messages a day to Gmail accounts | All senders: SPF or DKIM. Bulk senders: SPF and DKIM, a DMARC record (p=none is enough), and a From domain aligned with SPF or DKIM. Bulk senders also need one-click unsubscribe on marketing mail and spam rates in Postmaster Tools below 0.3%. |
| Yahoo | All senders, with stricter rules for bulk senders, from February 2024 | SPF and DKIM, a DMARC policy and alignment for bulk senders, plus one-click unsubscribe and low complaint rates. Check Yahoo's sender best practices for current thresholds. |
| Outlook.com (Hotmail, Live, Outlook consumer addresses) | Senders of more than 5,000 messages a day, enforced from May 5, 2025 | SPF and DKIM passing, and DMARC at least p=none aligned with SPF or DKIM. |
How to check your setup
Query the records directly from a terminal to see exactly what receivers see:
dig +short TXT example.com
dig +short TXT [selector]._domainkey.notify.example.com
dig +short TXT _dmarc.example.com- Send a real message from each tool to a Gmail address and open Show original. It lists SPF, DKIM and DMARC as PASS or FAIL, and the
Authentication-Resultsheader shows which domain each one passed for. - Check that the domain after
smtp.mailfrom=and theheader.d=in DKIM match your From domain, or a subdomain of it. That match is alignment. - Verify your domains in Google Postmaster Tools to see authentication rates, spam rate and reputation for Gmail traffic.
- Keep reading DMARC aggregate reports after enforcement. They are how you find a new tool, or a changed provider setting, before customers report missing mail.
Where SaaS setups usually break
- A second SPF record added when a new tool was connected, leaving two
v=spf1records and SPF failing for everything. - An SPF record over the 10-lookup limit after years of added includes.
- A provider still signing with its own
d=domain because domain authentication was never completed, so DKIM passes but DMARC fails. - Product mail authenticated on a subdomain while the marketing tool sends from the root domain with nothing set up.
- Billing or helpdesk tools nobody listed, which start bouncing the day the policy moves to
p=reject. - Domains provisioned by scripts or AI agents that start sending before the DNS records resolve. Check the records in DNS before allowing a send, not only that they were created.
Frequently asked questions
- Do I need all three, or is DKIM enough?
- For any meaningful volume you need all three. Gmail asks all senders for SPF or DKIM, but bulk senders to Gmail, Yahoo and Outlook.com need SPF, DKIM and a DMARC record. DMARC is also the only one of the three that protects your From address from spoofing.
- Is p=none enough?
- It meets the bulk-sender minimum and starts the reports, but it tells receivers to deliver failing mail anyway, so it does not stop spoofing. Treat it as the first step towards quarantine and reject.
- Will DMARC improve my deliverability?
- Authentication is a prerequisite, not a guarantee. Without it, large providers can reject or junk your mail; with it, placement still depends on your domain's reputation, complaint rates and how wanted your mail is.
- Should transactional and marketing email use separate subdomains?
- It is a widely used pattern. Each subdomain carries its own records and reputation, which keeps campaign complaints from affecting password resets and receipts, and keeps each SPF record well under the lookup limit.
- Do subdomains need their own DMARC record?
- No. A subdomain without one inherits the organizational domain's policy, from sp when it is set and p when it is not. Publish a separate record only when a subdomain needs a different policy or reporting address.
Sources
- RFC 7208: Sender Policy Framework (SPF)
- RFC 6376: DomainKeys Identified Mail (DKIM) Signatures
- RFC 7489: Domain-based Message Authentication, Reporting, and Conformance (DMARC)
- Google: Email sender guidelines
- Yahoo: Sender best practices
- Microsoft: Outlook's new requirements for high-volume senders
- Google Postmaster Tools
Related reading
- Password Reset and Login Link Email Reliability
Fix the authentication, isolation, and retry gaps that silently lock users out.
- List-Unsubscribe Header Requirements for Bulk Senders
Bulk senders now need unsubscribe headers in their infrastructure, not templates.
- Transactional vs Marketing Email in a Single SaaS API
Separate sending streams protect password resets from marketing sends.
- Zero-Touch Domain Provisioning APIs That Let Agents Self-Configure Without Human Oversight
Autonomous AI agents need APIs that complete domain setup without human DNS work or approval.
- Broadcast Campaign Strategy for Opted-In SaaS Audiences
Opt-in protects you legally, but reputation depends on sending.