Guides

SPF, DKIM and DMARC: what they are and how to set them up

Updated on 10/09/2026

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.

The three records side by side
RecordWhere it lives in DNSWhat it provesRecord type
SPFOn the return-path (MAIL FROM) domainThat the delivering server may send for that domainTXT
DKIMAt selector._domainkey.yourdomainThat the message was signed by the domain and not alteredTXT or CNAME
DMARCAt _dmarc.yourdomainThat the visible From domain matches SPF or DKIMTXT

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:

TXT 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.

Qualifiers for the all mechanism
QualifierMeaningWhen to use
-allFail: reject anything not on the listWhen you're sure every service that sends for you is listed
~allSoft fail: accept with suspicionThe safest default, especially with DMARC published
?allNeutral: says nothingAlmost never. Same as having no policy
+allApproves any server in the worldNever. 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

  1. 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.
  2. Going over 10 DNS lookups. Every include counts, and some services pull in others. Above 10, SPF fails for everyone.
  3. 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.
  4. Using +all or ?all, which in practice authorize any server.
  5. 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:

CNAME records
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.com

The 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

  1. 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.
  2. Your DNS provider's proxy or acceleration turned on for the CNAME. The record must answer with the real target, with nothing in between.
  3. 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.
  4. 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.

TXT record at _dmarc.yourcompany.com
v=DMARC1; p=none; rua=mailto:dmarc@yourcompany.com

Alignment: 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.

DMARC record tags
TagWhat it doesExample
vVersion. Must come firstv=DMARC1
pPolicy for the domainp=none, p=quarantine or p=reject
spPolicy for subdomains. Without it, p appliessp=reject
ruaWhere daily aggregate reports gorua=mailto:dmarc@yourcompany.com
pctPercentage of messages the policy applies topct=25
adkim and aspfRelaxed (r) or strict (s) alignment for DKIM and SPFadkim=r; aspf=r
DMARC policies
PolicyWhat the provider doesWhen to use it
p=noneOnly monitors and sends reportsAt the start, to find out who sends for your domain
p=quarantineSends failing mail to spamAfter confirming all your sending passes
p=rejectRejects failing mailMaximum 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.

DMARC at a more mature stage
v=DMARC1; p=quarantine; pct=50; rua=mailto:dmarc@yourcompany.com; adkim=r; aspf=r

How 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

  1. Publish p=none with rua and let it run for two to four weeks.
  2. Fix every legitimate service that shows up failing in the reports.
  3. Move to p=quarantine with pct=25, then 50 and 100, checking the reports at each step.
  4. With everything passing, switch to p=reject.

The right setup order

  1. Publish the sending platform's DKIM records.
  2. Set up the return-path (MAIL FROM) domain with the MX and SPF the platform gives you.
  3. Publish DMARC with p=none.
  4. Wait for DNS propagation, which takes from minutes to a few hours.
  5. 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:

headers of an approved message
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.com

Authentication 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.

WiseData Mail does this part for you

DNS assistant, automatic suppression and deliverability health panel on every plan.