Cloud & DevOps
SPF, DKIM and DMARC explained: stop your business emails landing in spam
If your invoices and replies keep ending up in spam, three DNS records are usually the reason. What SPF, DKIM and DMARC do, what Gmail now expects, and how to set them up safely.
By Aftab Farhan4 min read
Short answer: SPF, DKIM and DMARC are three DNS records that prove an email really came from your domain. SPF lists the services allowed to send for you, DKIM adds a signature that shows the message wasn't changed, and DMARC tells inboxes what to do when a check fails and sends you reports. Without them, Gmail, Outlook and Yahoo are far more likely to send your emails to spam.
Why this matters now
Google's sender guidelines require every sender to Gmail to set up SPF or DKIM. Anyone sending more than 5,000 messages a day to Gmail addresses needs all three, with the From address aligned to SPF or DKIM, plus one-click unsubscribe on marketing emails. Yahoo and Microsoft have similar rules. Even if you send far less, inboxes trust authenticated mail more.
SPF: who is allowed to send
SPF is a TXT record that lists the servers and services allowed to send email for your domain, such as Google Workspace, Microsoft 365 or your newsletter tool. It looks like this:
v=spf1 include:_spf.google.com ~all- Only one SPF record per domain. Two records break both. Add every service to the same record.
- Stay under 10 DNS lookups. Each
include:counts. Too many and SPF fails. - End with
~all(soft fail) while testing, then consider-allonce you're sure the list is complete.
DKIM: a signature on every email
With DKIM, your email service signs each message with a private key, and you publish the matching public key in DNS. The receiving inbox checks the signature. If someone changed the message on the way, or it wasn't sent by your service, the check fails. Your email provider gives you the record to add; use a 2048-bit key if they offer it.
DMARC: the rule and the report
DMARC ties SPF and DKIM to the address people actually see in the From line, and tells inboxes what to do when a message fails. It lives at _dmarc.yourdomain.com:
v=DMARC1; p=none; rua=mailto:dmarc-reports@yourdomain.com- p=none: only report. Start here, so nothing legitimate gets blocked.
- p=quarantine: failing mail goes to spam.
- p=reject: failing mail is refused. Strongest protection against people faking your domain.
How to set it up safely, step by step
- List everything that sends email as you: your mailbox provider, website contact form, newsletter, invoicing and booking tools.
- Add or fix your SPF record so it includes all of them, in one record.
- Turn on DKIM in each service and add the records it gives you.
- Add DMARC with p=none and a reporting address.
- Read the reports for two to four weeks. Free tools turn them into a readable list of who sends as you.
- Fix anything that fails, then move to quarantine and later reject.
How we set up neuhaze.com
Our domain uses two services: Cloudflare Email Routing receives mail for info@neuhaze.com, and Resend sends our website emails and newsletter. The SPF record on the main domain covers Cloudflare. Resend sends from its own subdomain with its own SPF record, and signs every message with DKIM, so our contact form replies and newsletters pass both checks. DMARC is at p=none while we review reports; the next step, for any domain once the reports are clean, is quarantine.
How to check your records
- Send an email to a Gmail address, open it, choose Show original, and look for SPF, DKIM and DMARC: PASS.
- Use a free checker such as MXToolbox or your DNS provider's tools to see the records.
- If you send to many Gmail users, register your domain in Google Postmaster Tools to watch your spam rate. Google asks senders to keep it below 0.3%, ideally under 0.1%.
Frequently asked questions
Do I need DMARC if I only send a few emails a day?
It isn't strictly required for small senders, but it's free, takes minutes, and stops scammers from easily sending fake emails in your name. We recommend it for every business domain.
Will DMARC p=reject block my own emails?
It can, if a tool that sends for you isn't covered by SPF or DKIM. That's why you start at p=none and read the reports before tightening the policy.
Why do my emails still go to spam with all three set up?
Authentication proves who you are, not that people want your mail. Spam complaints, sending to old lists, missing unsubscribe links and spammy content can still hurt delivery.
Setting up domains, DNS and email for clients is part of our cloud deployment and management work. For a real example of careful DNS changes, read how we moved a live store to Cloudflare with zero downtime.
- DNS
- Deliverability
- SPF
- DMARC
Aftab Farhan
Co-Founder


