Answer first, three DNS records that prove mail is yours #
SPF, DKIM, and DMARC are DNS-based standards that authenticate outbound email and block spoofing. SPF lists which servers may send mail for your domain. DKIM adds a cryptographic signature proving the message was authorized and unaltered. DMARC ties them together, telling receivers what to do when checks fail and where to send reports. Together they protect deliverability and sender reputation.
If you send transactional mail such as sign-in links, receipts, or notifications, these records are foundational. Without them, receivers cannot distinguish your mail from forgery, and your messages drift toward spam. Google's bulk sender guidelines (https://support.google.com/mail/answer/81126) now require authentication for serious senders, so this is compliance as well as hygiene.
Think of the trio as venue security for your domain. SPF is the guest list at the door: only listed senders walk in. DKIM is a wax seal on every letter: proof it comes from the claimed sender and nobody opened it. DMARC is the standing order to the guards: what to do with anyone who fails either check, and a nightly report of everyone turned away. All three or the venue is theater.
Try it: Domain Name Ideas — so you can try this on your own site now.
Why does email need authentication? #
Email needs authentication because the From address is trivially forgeable: without SPF, DKIM, and DMARC, receivers cannot distinguish your sign-in links and receipts from phishing, invoice fraud, or fake resets. Scope: Google's bulk-sender guidelines now require authentication for serious senders. Constraint: authentication proves identity but never guarantees inbox placement; reputation is earned on top of it.
Email was designed in an era of implicit trust. The From address is easy to forge, so anyone can send a message claiming to be your domain. That enables phishing, invoice fraud, and fake password resets that erode user trust one incident at a time.
Receiving servers therefore look for authentication signals before deciding where to place a message. SPF and DKIM each provide one signal. DMARC lets the domain owner demand enforcement. Authentication does not guarantee inbox placement, but missing authentication nearly guarantees poor deliverability as volume grows. Reputation is earned on top of identity, and without identity there is nothing to attach reputation to.
For app builders this connects directly to auth flows. Magic links and verification codes sent from your domain only work if receivers trust them. The BYOB auth guide (https://byob.studio/blog/byob-auth-better-auth-d1) covers the application side of those flows. Setting up SPF, DKIM, and DMARC is part of shipping auth, not an optional extra you schedule for later.
| Record | Proves | Fails when | Action on fail |
|---|---|---|---|
| SPF | Server may send for domain | Return path mismatch | DMARC policy applies |
| DKIM | Content intact and authorized | Signature bad or missing | DMARC policy applies |
| DMARC | Alignment and policy | Neither SPF nor DKIM aligns | Quarantine or reject per policy |
| Reporting | Aggregate view | Any auth gap | Read and tighten |
Who is allowed to send under SPF? #
An SPF record is a TXT record on your domain that lists the servers authorized to send mail for it. RFC 7208 (https://www.rfc-editor.org/rfc/rfc7208) defines the framework: receivers check the sending server address against your published list, and a match passes while anything else fails or soft-fails depending on your qualifier.
; SPF: authorize your provider, default deny the rest
example.com. TXT "v=spf1 include:_spf.provider.example ~all"SPF has practical limits worth knowing. It validates the envelope sender, not the visible From header users see, which is why spoofing can survive SPF alone. It also breaks under naive forwarding, because the forwarder address is not on your list. Keep the record accurate as you add email providers, and stay within the DNS lookup limit by flattening includes when providers recommend it. Ten lookup limit, one record: SPF rewards tidy sending infrastructure and punishes archaeology.
Publish SPF as soon as you send from a domain, even at low volume. It is the simplest statement of sending authority, and it costs one TXT record.
How does DKIM prove the message is intact and authorized? #
DKIM signing adds a cryptographic signature to each outgoing message header. RFC 6376 (https://www.rfc-editor.org/rfc/rfc6376) defines the mechanism: your provider holds a private key and publishes the matching public key as a DNS TXT record under a selector name. Receivers fetch the public key, verify the signature, and confirm the signed content was not altered in transit.
; DKIM: public key under a provider-given selector
s1._domainkey.example.com. TXT "v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3..."Because the signature covers message content and selected headers, DKIM survives forwarding better than SPF and binds approval to the message itself rather than the road it traveled. Key management is straightforward. Generate the key pair with your email provider, publish the provided TXT record, and enable signing. Rotate selectors when providers advise it, the way you rotate any credential: before it matters, not after.
A valid DKIM signature proves two things. The holder of the private key approved the message, and the signed parts arrived unchanged. That is a stronger claim than server identity alone. The wax seal holds even when the courier changes.
How do DMARC policy and reporting work? #
DMARC is a TXT record on a reserved subdomain that tells receivers how to handle mail claiming to be from your domain when SPF or DKIM fail, and where to send aggregate reports. RFC 7489 (https://www.rfc-editor.org/rfc/rfc7489) defines the policy framework and the reporting format that makes rollout safe.
; DMARC: start monitoring, tighten later
_dmarc.example.com. TXT "v=DMARC1; p=none; rua=mailto:dmarc@example.com"Policies progress from monitoring to enforcement. A monitoring policy requests reports without changing delivery. Quarantine asks receivers to treat failures as suspicious. Reject asks them to block failures outright. Cloudflare's email records guide (https://developers.cloudflare.com/dns/manage-dns-records/how-to/email-records/) shows where these records live alongside your other mail DNS.
Alignment is the central concept. DMARC requires that the domain verified by SPF or DKIM aligns with the visible From domain. This closes the gap where SPF passes for a provider domain while the user sees your brand. Reports then show who sends as your domain, which sources pass, and where spoofing attempts appear. Read them. The reports routinely reveal forgotten services sending as you, marketing tools nobody told engineering about, and outright forgery attempts.
Roll out DMARC gradually. Start with monitoring, read the reports, fix legitimate sources that fail, then move toward enforcement. Schedule the tightening explicitly. A monitoring record left for a year is a decision postponed, not a policy. Put the enforcement date on the calendar when you publish the first record. Jumping straight to reject before third-party senders are aligned can block real mail, including the receipts your customers are waiting for.
How do you roll out authentication while protecting sender reputation? #
Roll out SPF, DKIM, and DMARC authentication in 4 steps: publish SPF first, enable DKIM signing second, add DMARC in monitoring mode third, then tighten to enforcement once reports look clean. Prerequisites: provider checkers plus seed mailboxes at major providers. Constraint: warm new domains gradually from expected transactional mail upward, and put the enforcement date on the calendar when the first record goes live.
Sender reputation is the long term trust receivers assign to your domain and sending infrastructure. Authentication feeds it, but so do consistent volumes, low complaint rates, and valid recipient lists. Think of SPF, DKIM, and DMARC as identity documents. Good behavior still determines the score. Documents get you through the door. Conduct decides whether you are welcomed back.
A reliable order is to publish SPF first, enable DKIM signing second, add DMARC in monitoring mode third, and tighten to enforcement once reports look clean. Verify each step with provider checkers and seed mailboxes before raising volume.
Warm new domains gradually instead of launching at full volume on day one. Start with transactional mail your recipients expect, such as signups and receipts, since wanted mail earns opens and replies that build reputation fast. Add marketing volume in steady steps while watching complaint rates and bounce codes daily. A sudden spike from a cold domain reads as compromise to receivers, and the reputation hole takes weeks to climb out of. Seed mailboxes at major providers catch placement problems before campaigns do. Keep authentication records under review whenever vendors change: every new sender belongs in SPF, every new stream needs DKIM signing, and DMARC reports will confirm both. Authenticated, aligned mail gives every transactional message the best chance to arrive, and every magic link the best chance to actually log someone in.
What are the trade-offs? #
SPF lists senders, DKIM signs intact mail, DMARC sets policy plus reporting. Roll out monitoring first, enforce after reports.
| Where the trio wins | Where it loses |
|---|---|
| Receivers trust sign in links, receipts, and notifications | DNS propagation plus selector wiring takes careful copy paste |
| Aggregate reports show who sends as you before blocking | Forwarding and shared infra break naive strict policies |
| Steady volumes plus low complaints build reputation | No records means spoofed invoice and reset mail erodes trust per incident |
Stay in monitoring while reports are unread. Enforce reject once legitimate streams pass cleanly.
Who this is for (and who should skip it) #
SPF, DKIM, and DMARC fit domains sending sign-in links, receipts, or notifications where receivers must trust the mail came from you. Start in monitoring mode and tighten only when alignment is clean. Limit: SPF has a ten-lookup limit and breaks under naive forwarding, while strict DMARC before alignment blocks real mail.
This fits if your domain sends sign in links, receipts, or notifications and you want receivers to trust that mail came from you. Authentication protects deliverability and trust.
Skip waiting for enforcement until you have real aggregate reports. Start in monitoring mode and tighten only when SPF and DKIM alignment is clean.
One limit to know. SPF has a ten lookup limit and breaks under naive forwarding, while strict DMARC before alignment blocks real mail. Start DMARC in monitoring, read reports, fix legit sources, then tighten on a set date.
- Best for developers proving outbound mail with SPF, DKIM, and DMARC records.
- Best for startups protecting sign-in links and receipts from spoofing and spam folders.
- Best for small business owners rolling out authentication in steady order to build reputation.
What we learned building this #
BYOB apps that send transactional mail use provider verified sending, and the auth layer that proves ownership lives in DNS rather than in app code. The pattern we document pairs Better Auth with D1 for session handling and leaves SPF, DKIM, and DMARC set at the domain registrar to align sending domain with verification records. This keeps mail deliverability tied to domain control, not to per project code.