How to set up SPF, DKIM & DMARC
Published 21 October 2026 · 6 min read
If your app sends email — password resets, receipts, welcome messages, notifications — you need three DNS records: SPF, DKIM, and DMARC. Together they prove that email claiming to come from your domain is really from you. Without them, two bad things happen: anyone can send email pretending to be your domain, and your legitimate email is far more likely to land in spam.
The good news is that setting them up is a one-time job. You add a few records at your DNS provider (wherever your domain lives — Cloudflare, Namecheap, GoDaddy, Google Domains, etc.), and your email provider gives you most of the values. Here is what each record does and exactly what to add.
What each record actually does
- SPF (Sender Policy Framework) lists which servers are allowed to send email for your domain. When a receiving server gets your message, it checks the sending server against this list.
- DKIM (DomainKeys Identified Mail) adds a cryptographic signature to every message you send. The receiver uses a public key published in your DNS to confirm the message really came from you and wasn't tampered with in transit.
- DMARC (Domain-based Message Authentication, Reporting & Conformance) ties the other two together. It tells receiving servers what to do with mail that fails SPF and DKIM — let it through, send it to spam, or reject it outright — and it can send you reports showing who is sending email as your domain.
Why this matters for your app
Picture a founder whose app sends password-reset emails. With no SPF, DKIM, or DMARC, nothing stops a scammer from sending "reset your password" emails that appear to come from your exact domain. Customers can't tell the difference, and a phishing campaign in your name damages trust you spent months building.
The flip side is deliverability. Mailbox providers like Gmail and Outlook increasingly require authentication before they trust a sender. If your records are missing or wrong, your real transactional email gets filtered to spam — so users never receive the reset link and assume your app is broken. These records fix both problems at once.
1. Add your SPF record
SPF is a single TXT record on your root domain. You usually only need one SPF record, and it should include every service that sends email for you. Your email provider documents the exact value — a common pattern looks like this:
- Type: TXT
- Name / Host:
@(your root domain) - Value:
v=spf1 include:_spf.yourprovider.com ~all
Replace include:_spf.yourprovider.com with the value your provider gives you. If you send through more than one service, add each one as another include: in the same record — don't create a second SPF record, as that breaks SPF entirely.
2. Add your DKIM record
You don't write the DKIM record yourself — your email provider generates the keys and tells you exactly what to publish. In Resend, Postmark, SendGrid, Mailgun, or whatever you use, add your domain in their dashboard and they'll show you one or more records to copy:
- Type: TXT (some providers use a CNAME instead)
- Name / Host: something like
resend._domainkeyors1._domainkey - Value: a long string starting with
v=DKIM1; k=rsa; p=…(or a CNAME target they provide)
Copy the name and value exactly as shown. After you save them, your provider has a "verify" button that confirms the records are live.
3. Add your DMARC record — and start gently
DMARC is one TXT record at a special subdomain. The important part is the policy (p=), which tells receivers what to do with mail that fails. Don't jump straight to the strictest setting — roll it out in stages so you don't accidentally block your own legitimate email.
Start here (monitor only, nothing gets blocked):
- Type: TXT
- Name / Host:
_dmarc - Value:
v=DMARC1; p=none; rua=mailto:dmarc@yourdomain.com
The rua= address receives aggregate reports so you can see who's sending as your domain and confirm your own mail passes. Watch these reports for a week or two.
Once your legitimate email is passing cleanly, tighten the policy to p=quarantine (failing mail goes to spam). After you're confident everything is healthy, move to the strictest setting, p=reject (failing mail is rejected outright). The progression is simple: none → quarantine → reject.
How to check it worked
- Use your email provider's built-in domain verification — it confirms SPF and DKIM are detected.
- Send yourself a test email, then view the message's "show original" / headers in Gmail; it reports whether SPF, DKIM, and DMARC passed.
- Run a free surface scan with Faultline to see your domain's email and DNS posture at a glance.
Check your app in 30 seconds
Faultline scans no-code & AI-built apps for exactly these issues — free.
Run a free scanFaultline's free surface scan works on any website — it checks your TLS, security headers, and DNS/email setup, including whether these records are present. Our deeper data-exposure engine currently specializes in Base44, with more platforms rolling out. For email specifically, follow the steps above, publish the records, and verify them with your provider — it's one of the highest-value hours you can spend on your app's security.
Related: The no-code security checklist · Is Base44 secure?