Every application sends email, whether or not anyone thinks of it as an email product. Password resets, order confirmations, invoices, the notification a contact form sends to the owner: all of it goes out under a domain, and all of it is judged on arrival by the same three DNS records. When one of them is missing or wrong, nothing errors in your code. The message is accepted by your mail server, handed on, and then quietly filed as spam or refused by Gmail, Yahoo or Outlook. You find out when a customer says the reset link never came.
This is the developer-side version of a guide we wrote for business owners. It skips the why-should-I-care part and goes through what a receiving server actually checks, what the records look like in DNS, using our own domains as the example, and the three places where applications most often break them.
What the receiving server checks
SMTP never verified the sender. The From line is text the sending side writes, and the protocol lets anyone write any address there. So a receiving server works it out from DNS, in three steps that each cover a gap the others leave.
SPF looks at the envelope sender, the address in MAIL FROM during the SMTP conversation (it later becomes the Return-Path header), and asks whether the IP address that connected is allowed to send for that domain. DKIM looks for a DKIM-Signature header, fetches a public key from DNS and verifies the signature over the headers and body it names. DMARC then asks the question the other two cannot: did either of them pass for the domain in the visible From: header, the one the reader sees?
That last step is the one that surprises people. SPF and DKIM can both pass while DMARC fails, because each can pass for a different domain than the one in From. It is called alignment, and it is behind most of the "but my SPF is fine" support threads.
SPF: one record, ten lookups
Reading the records needs nothing more than dig. Here is ours:
$ dig +short TXT levelui.com
"v=spf1 include:_spf.mail.hostinger.com ~all"
"google-site-verification=…"
The SPF record is the one that starts with v=spf1. It says: mail for levelui.com may come from whatever our mail host lists under _spf.mail.hostinger.com, and anything else should be treated as suspicious. ~all (softfail) asks receivers to mark other mail as suspicious; -all (fail) asks them to reject it. With DMARC in place, either works, because DMARC makes the final decision.
The include is resolved at check time, and it can contain includes of its own:
$ dig +short TXT _spf.mail.hostinger.com
"v=spf1 include:relay.mail.hostinger.com include:relay.mailchannels.net ~all"
This is where the first hard limit lives. RFC 7208 allows at most 10 mechanisms that need a DNS query while one SPF record is evaluated: include, a, mx, ptr, exists and the redirect modifier all count, and so do the ones inside every include, recursively. Past 10, the result is a permanent error, and SPF fails for every message. Ours uses three: our include, plus the two inside it. The two at the bottom list only ip4 and ip6 ranges, which cost nothing.
Three of ten sounds comfortable until a project adds a newsletter tool, a CRM, a helpdesk and a transactional mail service, each with an include that pulls in two or three more. Check the total whenever you add one. The other rule that catches people is that a domain may publish exactly one SPF record. A second one, often added by a new service's setup wizard, does not extend the first; it breaks both, and receivers treat SPF as broken.
DKIM: a key under a selector
DKIM keys live under a name made of a selector and the fixed label _domainkey. The selector is whatever the sending service chose, and it travels in the signature as s=, next to the signing domain as d=. Our mail host uses hostingermail1:
$ dig +short TXT hostingermail1._domainkey.levelui.com
"v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsMz6rFA+sAJsVWJZWhxla9y0QJUL..." "rpUnScY/JfM7+K6NvRtEsch07fscMgagCODSiSI06XUTkeW5NCYEGBLUBtoL+ifWYFTgmhK/fD7Y..."
Two things are worth seeing in that output. The key is 2048-bit RSA, which is the sensible size; Gmail requires at least 1,024 bits from bulk senders. And the record comes back as two quoted strings, because a single DNS TXT string cannot be longer than 255 characters and a 2048-bit key is longer than that. Receivers join the strings before parsing. Some DNS control panels split them for you, some expect you to paste them already split, and a key pasted into the wrong kind of field is a common reason a freshly added DKIM record fails with "no key" or "bad key".
Unlike SPF, a DKIM signature survives forwarding, because it travels inside the message instead of depending on which server delivered it. That is why DMARC can still pass for a message that went through a mailing list or a forwarding rule, as long as the list did not modify the signed parts.
DMARC: alignment, policy and reports
$ dig +short TXT _dmarc.levelui.com
"v=DMARC1; p=quarantine; rua=mailto:*Emails are not allowed*; pct=100"
p is the policy for mail that fails: none delivers it and only reports, quarantine puts it in spam, reject refuses it. rua is where the large providers send daily aggregate reports: XML files listing every IP address that sent mail as your domain and whether SPF, DKIM and DMARC passed for it. Those reports are how you find the senders you forgot about.
Alignment is relaxed by default, which means the domains have to share an organisational domain rather than match exactly: a signature with d=mail.example.com aligns with From: *Emails are not allowed*. Adding adkim=s or aspf=s makes it strict. Most sites should leave it relaxed.
Reports for one domain can go to an address on another, but only if the receiving domain agrees, otherwise anyone could point their reports at your inbox. We send the reports for levelui.ro and levelui.de to the levelui.com mailbox, so levelui.com publishes one tiny authorisation record per domain:
$ dig +short TXT levelui.ro._report._dmarc.levelui.com
"v=DMARC1"
Without those records, the reports for the two country domains would simply not arrive, and nothing anywhere would tell you.
DMARC was revised in May 2026 as RFC 9989, which replaces RFC 7489. The revision drops the pct tag, which applied the policy to a percentage of mail, and adds a t tag for testing. A record with pct=100, like ours, asked for the full policy anyway, so it keeps working exactly as before.
Where applications break it
The records are the easy part. What breaks them in practice is code and configuration that sends mail as the domain from somewhere the records do not cover.
Contact forms on shared hosting. A form that calls PHP's mail(), or any library that hands the message to the web server's local mail transfer agent, sends from the web server's IP address. That address is usually not in your SPF record, and the message carries no DKIM signature for your domain. Both checks fail, so DMARC fails, and the enquiry the whole website exists for lands in spam. The fix is to send through the real mailbox over authenticated SMTP, exactly as a mail client would. In Node, with nodemailer:
import nodemailer from 'nodemailer'
const transport = nodemailer.createTransport({
host: process.env.SMTP_HOST, // the mailbox provider's SMTP server, not localhost
port: 465,
secure: true,
auth: { user: process.env.SMTP_USER, pass: process.env.SMTP_PASS },
})
await transport.sendMail({
from: '"Example Shop" <*Emails are not allowed*>', // a real mailbox on the domain your records cover
replyTo: visitorEmail, // the visitor goes here, never in From
to: '*Emails are not allowed*',
subject: 'New enquiry from the website',
text: message,
})
The comment on replyTo matters as much as the SMTP settings. A form that puts the visitor's own address in From: is sending mail as gmail.com or as their company's domain, from your server. DMARC fails for their domain every time, and if their domain publishes p=reject, the notification is refused outright. Send from your own address and put theirs in Reply-To, so pressing reply still reaches them.
Third-party senders signing as themselves. Transactional and newsletter services send from their own servers, so their mail passes SPF for their bounce domain and DKIM for their signing domain, both valid and neither aligned with yours. DMARC fails. Every serious service offers the fix under a name like "domain authentication" or "custom sending domain": a few CNAME or TXT records that let it sign with d=yourdomain and, ideally, use a return-path on your domain too. It takes ten minutes per service and is the single most common thing missing when DMARC reports show failures.
The second SPF record. Covered above, and worth repeating because it is so easy to do from a setup wizard: add the new service's include to the existing record, never a record of its own.
Rolling it out without losing mail
Start with an inventory: everything that sends with your domain in From, including the website, the shop, the CRM, the helpdesk, the invoicing app and any cron job that emails a report. Merge them into one SPF record and turn on DKIM in each service.
Publish DMARC at p=none with a rua address first, read the reports for two to four weeks, and only then tighten it. The reports will show the old booking tool or the forgotten staging server still sending as your domain. Fix each one, move to quarantine, then to reject once the reports are clean. Starting at reject is how teams discover a forgotten sender by losing its mail.
For single messages, you do not need the reports. In Gmail, Show original prints the SPF, DKIM and DMARC result for any message you receive, and the raw Authentication-Results header names the domain each one passed for. Send a test from every service in the inventory to a Gmail address and read that header; it answers the alignment question directly.
Why the big providers made it mandatory
Since February 2024, Gmail and Yahoo require at least SPF or DKIM from every sender, and SPF, DKIM, an aligned DMARC record and one-click unsubscribe from anyone sending 5,000 or more messages a day to their users. Gmail tightened enforcement on non-compliant mail from November 2025. Outlook.com set the same bar for high-volume senders on 5 May 2025 and refuses failing mail with 550 5.7.515; Gmail's equivalent is 5.7.26.
Most applications are nowhere near 5,000 messages a day, and it does not matter. The filters that read these records run on every message, and a domain without DMARC is also the easiest one for someone else to send phishing as. One more record rewards getting the three right: once DMARC is at quarantine or reject, a BIMI record can point to a logo that Yahoo and AOL show next to your messages (ours is at default._bimi.levelui.com). Gmail and Apple Mail additionally want a paid certificate. It is decoration, not delivery, but it is a nice sign that the rest is in order.
The original
This is the developer-side version of a guide on our site written for business owners. The original has the side-by-side table of the three records and the provider requirements table, the setup order for non-technical teams, why mail can still land in spam when all three pass, and answers to the questions clients ask, such as whether a contact form needs SPF and DKIM at all.
SPF, DKIM and DMARC explained: why your emails land in spam
This copy is a snapshot from the day it was posted, and it will not be updated here. The original on our site is the version we keep current: when a study publishes new figures, a price changes or a tool is renamed, that is where the correction lands. If you want the up-to-date version, follow the link above.
Also available in German and Romanian.
Sources
The SPF evaluation rules, including the limit of 10 DNS-querying terms and the permanent error past it, are in RFC 7208, and the DKIM signature and selector record in RFC 6376. DMARC is now RFC 9989, published May 2026, which obsoletes RFC 7489 and removes pct; the authorisation record for reports sent to another domain was defined in RFC 7489, section 7.1. The Gmail requirements, the 1,024-bit minimum and error 5.7.26 are from Google's Email sender guidelines and the November 2025 enforcement from its FAQ; Yahoo's are on its Sender Hub, and Outlook.com's in Microsoft's article on error 550 5.7.515. The records shown are ours, read from public DNS on 18 November 2026; the nodemailer example is illustrative, with example.com addresses.
What was the sender you found in your first week of DMARC reports that nobody on the team knew was still sending?