Guides
SPF, DKIM and DMARC: what they are and how to set them up
SPF says which servers may send for your domain. DKIM signs the message to prove it wasn't altered. DMARC checks that the sender's domain matches what was validated, tells the mailbox provider what to do when it doesn't, and sends you reports. Since February 2024, Gmail and Yahoo require all three from bulk senders.
Why these records exist
The email protocol doesn't check who the sender is. Any server can send a message claiming it comes from hello@yourcompany.com. SPF, DKIM and DMARC are records published in your domain's DNS that let the recipient's mailbox provider (Gmail, Outlook, Yahoo) check whether the message was really authorized by you.
Without them, email tends to land in spam or be rejected. Gmail asks every sender for SPF or DKIM. From anyone sending more than 5,000 messages a day to Gmail accounts, it requires all three, with the sender's domain aligned. Yahoo adopted equivalent rules at the same time.
| Record | Where it lives in DNS | What it proves | Record type |
|---|---|---|---|
| SPF | On the return-path (MAIL FROM) domain | That the delivering server may send for that domain | TXT |
| DKIM | At selector._domainkey.yourdomain | That the message was signed by the domain and not altered | TXT or CNAME |
| DMARC | At _dmarc.yourdomain | That the visible From domain matches SPF or DKIM | TXT |
SPF: who may send for your domain
SPF (Sender Policy Framework) is a TXT record listing the servers authorized to send email with your domain in the return-path address. An example SPF record:
v=spf1 include:_spf.google.com include:_spf.sendingplatform.com ~all- v=spf1 opens the record.
- include: authorizes another service's servers (here, Google Workspace and a sending platform).
- ~all says anything not on the list should be treated with suspicion. -all rejects it outright.
A detail that trips up a lot of people: SPF is checked against the return-path address, the one that receives bounce notices, not the address shown in the From field. That's why SPF alone doesn't stop someone from using your name in From. DMARC closes that gap.
| Qualifier | Meaning | When to use |
|---|---|---|
| -all | Fail: reject anything not on the list | When you're sure every service that sends for you is listed |
| ~all | Soft fail: accept with suspicion | The safest default, especially with DMARC published |
| ?all | Neutral: says nothing | Almost never. Same as having no policy |
| +all | Approves any server in the world | Never. It cancels the whole SPF record |
The 10 DNS lookup limit
To validate SPF, the receiving provider may make at most 10 DNS lookups. The include, a, mx, ptr and exists mechanisms and the redirect modifier count. The ip4, ip6 and all mechanisms don't. The catch is that one include can pull in others, and some services use up several lookups on their own. Above 10, the result is permerror and SPF fails for everyone, including your regular business email.
Before adding an include, check how many lookups the record already uses with an SPF checker. If you're at the limit, remove services that no longer send or move one of them to its own subdomain.
The most common SPF mistakes
- Having two SPF records on the same domain. The standard allows only one; with two, both are ignored. Merge the include entries into a single record.
- Going over 10 DNS lookups. Every include counts, and some services pull in others. Above 10, SPF fails for everyone.
- Forgetting a system that sends on your behalf, such as your ERP, invoicing tool, CRM or website form. Its messages fail SPF and, with a stricter DMARC policy, go to spam.
- Using +all or ?all, which in practice authorize any server.
- Pasting the value with extra quotes, leading spaces or split across two lines in your domain provider's panel.
Sending platforms such as WiseData Mail usually use their own return-path subdomain (for example, mail.yourcompany.com) with its own SPF. That way the SPF on your main domain, which already serves your business email, doesn't need to change.
DKIM: the message signature
DKIM (DomainKeys Identified Mail) adds a digital signature to every email. The public key lives in your DNS; the recipient's provider uses it to check that the message came from an authorized server and that nobody changed the content along the way.
The signature travels in the DKIM-Signature header and states two things: the signing domain (d=) and the selector (s=), which is the key's name. With the selector, the provider knows which record to look up, in the format selector._domainkey.yourdomain. This lets you have several keys on the same domain, one per service.
Many sending platforms set up DKIM with CNAME records that point to keys the platform rotates periodically:
abc123._domainkey.yourcompany.com CNAME abc123.dkim.sendingplatform.com
def456._domainkey.yourcompany.com CNAME def456.dkim.sendingplatform.com
ghi789._domainkey.yourcompany.com CNAME ghi789.dkim.sendingplatform.comThe real values are generated for your domain. Copy exactly what the platform shows you.
DKIM best practices
- Use 2048-bit keys. 1024-bit keys are still accepted but are already considered weak.
- Have one selector per sending service. That way you can swap or turn off one without affecting the others.
- Sign with your domain, not the platform's. Only a signature with your domain counts toward DMARC alignment.
- Rotate keys from time to time. With CNAME, the platform does the rotating without you going back to DNS.
Common DKIM mistakes
- Duplicated domain in the record name. Many panels append the domain automatically, and the record becomes abc123._domainkey.yourcompany.com.yourcompany.com. In those panels, type only abc123._domainkey.
- Your DNS provider's proxy or acceleration turned on for the CNAME. The record must answer with the real target, with nothing in between.
- A long TXT key cut off when pasting. Values over 255 characters are split into parts that DNS joins back together; if one part is missing, the signature never validates.
- Deleting the old key before the platform confirms the new one.
DMARC: what to do when the check fails
DMARC (Domain-based Message Authentication, Reporting and Conformance) ties the other two together. It requires the visible sender domain to match the domain validated by SPF or DKIM (called alignment) and tells the provider what to do when it doesn't. It also asks for reports on who is sending on behalf of your domain.
v=DMARC1; p=none; rua=mailto:dmarc@yourcompany.comAlignment: the detail that breaks DMARC most often
For DMARC, it isn't enough for SPF or DKIM to pass. The validated domain has to match the domain in the From field. Example: the email goes out with From hello@yourcompany.com and a return path on mail.yourcompany.com. Under relaxed alignment, which is the default, both belong to the same domain and pass. If the return path were on sendingplatform.com, SPF would pass but wouldn't align, and DMARC would depend on DKIM alone.
| Tag | What it does | Example |
|---|---|---|
| v | Version. Must come first | v=DMARC1 |
| p | Policy for the domain | p=none, p=quarantine or p=reject |
| sp | Policy for subdomains. Without it, p applies | sp=reject |
| rua | Where daily aggregate reports go | rua=mailto:dmarc@yourcompany.com |
| pct | Percentage of messages the policy applies to | pct=25 |
| adkim and aspf | Relaxed (r) or strict (s) alignment for DKIM and SPF | adkim=r; aspf=r |
| Policy | What the provider does | When to use it |
|---|---|---|
| p=none | Only monitors and sends reports | At the start, to find out who sends for your domain |
| p=quarantine | Sends failing mail to spam | After confirming all your sending passes |
| p=reject | Rejects failing mail | Maximum protection against domain spoofing |
To meet the Gmail and Yahoo requirement, p=none is enough. The recommended path is to start with none, read the reports for a few weeks and tighten the policy gradually.
v=DMARC1; p=quarantine; pct=50; rua=mailto:dmarc@yourcompany.com; adkim=r; aspf=rHow to read DMARC reports
Aggregate reports arrive at the rua address as compressed XML, usually one per provider per day. Each row shows the sending IP, how many messages, whether SPF and DKIM passed and whether they aligned. Look for two things: legitimate services that fail, which you need to fix before tightening the policy, and unknown sources sending as you, which are exactly what quarantine and reject will block. At high volume, use a DMARC report reader that turns the XML into a dashboard.
From none to reject in four steps
- Publish p=none with rua and let it run for two to four weeks.
- Fix every legitimate service that shows up failing in the reports.
- Move to p=quarantine with pct=25, then 50 and 100, checking the reports at each step.
- With everything passing, switch to p=reject.
The right setup order
- Publish the sending platform's DKIM records.
- Set up the return-path (MAIL FROM) domain with the MX and SPF the platform gives you.
- Publish DMARC with p=none.
- Wait for DNS propagation, which takes from minutes to a few hours.
- Send a test and check the received message's headers to confirm SPF, DKIM and DMARC show as pass.
To check in Gmail, open the test message, click the three dots and choose Show original. The top of the page shows SPF, DKIM and DMARC as PASS or FAIL. In the full headers, the Authentication-Results line looks something like this:
Authentication-Results: mx.google.com;
dkim=pass header.i=@yourcompany.com header.s=abc123;
spf=pass smtp.mailfrom=mail.yourcompany.com;
dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=yourcompany.comAuthentication checklist
- A single SPF record per domain, under 10 DNS lookups.
- Every system that sends on your behalf listed in SPF or on its own subdomain.
- DKIM published and signing with your domain, with a 2048-bit key.
- DMARC published at _dmarc, with rua pointing to a mailbox someone reads.
- A test sent to Gmail with SPF, DKIM and DMARC at PASS.
- A plan with a date to move off p=none.
How WiseData Mail helps
WiseData Mail's DNS assistant shows the exact DKIM, MAIL FROM and DMARC records for your domain, checks whether they're already published and tells you when the domain is ready to send. It doesn't change your DNS: you copy the records into your domain provider's panel.
Want to know what to do when email bounces? Read the hard bounce and soft bounce guide.
DNS assistant, health panel and automatic suppression on every plan. See WiseData Mail's features.
Frequently asked questions
Can I have more than one SPF record?
No. The domain must have a single SPF record. If there are two, both are ignored. Merge the include mechanisms into one record.
Does DMARC with p=none protect my domain?
It doesn't block spoofing, but it meets the Gmail and Yahoo requirement and starts generating reports. Protection comes when you move to quarantine or reject.
How long does it take for the records to take effect?
It depends on the TTL set in your DNS. Usually a few minutes to a few hours; in rare cases, up to 48 hours.
If I already have DKIM, do I need SPF?
Yes. DMARC passes with either one aligned, but having both gives you redundancy: if a DKIM signature breaks along the way, for example when a message is forwarded, SPF can still carry it, and vice versa.
What does Gmail error 5.7.26 mean?
That the message didn't pass the authentication Gmail requires: usually DMARC failed because neither SPF nor DKIM aligned with the From domain. Check all three records and the alignment.
I use Google Workspace and a sending platform. What happens to SPF?
The main domain keeps a single SPF record with Google's include. The sending platform usually uses its own return-path subdomain with its own SPF, so you don't need to add another include to the main domain.
Keep reading
Hard bounce and soft bounce: what they are and what to do
The difference between a permanent and a temporary rejection, and why it affects your delivery.
Read the guideHow to create an email newsletter
From goal to editorial calendar: the step-by-step for a newsletter that reaches the inbox and gets read.
Read the guideHow to send bulk email from Gmail (and when to stop)
Gmail's official limits, Bcc versus mail merge, the risks to your domain and the signs it's time to use a platform.
Read the guide
WiseData Mail does this part for you
DNS assistant, automatic suppression and deliverability health panel on every plan.