Cybersecurity

SPF, DKIM and DMARC: How to Stop Criminals From Sending Email as Your Company

Sarah Chen By Sarah Chen • • 9 min read

SPF, DKIM and DMARC: How to Stop Criminals From Sending Email as Your Company

Email was designed in an era when every server on the network was trusted. The “From” address of a message is just text the sender types in, and nothing in the original protocol checks it. That is why a criminal can send an invoice to your customer that appears to come from [email protected], without ever touching your systems.

This is the engine behind much of business email compromise (BEC): the fake “we have changed our bank account” message, the urgent request from the “CEO” to buy gift cards, the forged supplier invoice. Three DNS records, SPF, DKIM and DMARC, are the standard answer. They cost little to publish, but rolling them out carelessly can block your own invoices, so this article explains both what they do and how to introduce them safely.

What Each Record Does

SPF (Sender Policy Framework) is a list, published in DNS, of the servers allowed to send mail for your domain. A receiving server looks at the connecting IP address and checks it against the list. SPF evaluates the hidden “envelope” sender (the return path), not the From address people see.

DKIM (DomainKeys Identified Mail) adds a cryptographic signature to each message. The sending service signs the message with a private key and you publish the matching public key in DNS under a “selector”. The receiver verifies the signature, which proves the message was authorised by the domain owner and was not altered in transit. Unlike SPF, DKIM usually survives forwarding.

DMARC (Domain-based Message Authentication, Reporting and Conformance) ties the two together. It says: the domain in the visible From address must match (be “aligned” with) a domain that passed SPF or DKIM, and here is what to do with mail that fails. It also asks receivers to send you reports, which gives you visibility into who is sending mail using your name.

The key point for decision makers: SPF and DKIM on their own do not protect the From address your customers see. DMARC alignment is what connects authentication to the visible sender, and the DMARC policy is what tells receivers to reject the forgery.

Step 1: Inventory Everything That Sends as Your Domain

Most failed rollouts fail here. Mail does not only leave from your mail server. Walk through the business and list every system that sends messages with your domain in the From address:

  • Your mail platform (Microsoft 365, Google Workspace or your own server)
  • CRM and sales automation
  • Invoicing and accounting software
  • Helpdesk and ticketing tools
  • Newsletter and marketing platforms
  • Web shop, booking system and application notifications
  • Monitoring alerts, printers and scanners
  • Agencies and freelancers who send on your behalf

Ask finance, marketing, support and development separately. Shadow IT is common: a team that signed up for a survey tool two years ago may be sending mail as you without IT knowing. The DMARC reports in step 4 will catch the stragglers, but a good inventory shortens the process.

Step 2: Publish a Correct SPF Record

An SPF record is a single TXT record at the root of the domain. Each sending service tells you which include: to add.

example.com.  IN TXT  "v=spf1 include:spf.protection.outlook.com include:_spf.crm.example.net include:mail.invoicing.example.org -all"

Three rules matter in practice:

  1. One SPF record per domain. Two records make SPF fail. Merge them into one.
  2. The 10 lookup limit. SPF evaluation may trigger at most 10 DNS lookups. Every include:, a, mx, exists and redirect counts, including the lookups nested inside the includes of your vendors. ip4: and ip6: ranges do not count. Exceed the limit and the result is a permanent error, which receivers treat as a failure. If you are near the limit, remove services you no longer use, and prefer sending from a dedicated subdomain for each big service instead of stacking everything on the root domain.
  3. The ending. ~all (soft fail) and -all (hard fail) both tell receivers the list is complete. Many organisations start with ~all and move to -all once reports show no legitimate senders failing.

Step 3: Enable DKIM for Each Service

DKIM is configured per sending service, not once per domain. Each service generates a key pair and gives you a DNS record to publish, usually a CNAME that points to the vendor’s key or a TXT record holding the public key.

selector1._domainkey.example.com.  IN CNAME  selector1-example-com._domainkey.vendor.example.net.
crm._domainkey.example.com.        IN TXT    "v=DKIM1; k=rsa; p=MIIBIjANBgkqh..."

Use 2048-bit keys where the service supports them, give each service its own selector so you can rotate or revoke one without touching the others, and send a test message to confirm the dkim=pass result in the headers. Most vendors call this feature “custom domain authentication” or “domain verification”. If a vendor cannot sign with your domain at all, that is a question for procurement.

Step 4: DMARC, Starting With Observation

DMARC is a TXT record at _dmarc.example.com. Start in monitoring mode. The policy p=none blocks nothing; it simply asks receivers to send you aggregate reports to the address in rua.

_dmarc.example.com.  IN TXT  "v=DMARC1; p=none; rua=mailto:[email protected]; adkim=r; aspf=r"

The aggregate (rua) reports are XML files that large mailbox providers send daily. They are unreadable by humans in bulk, so route them to a DMARC reporting tool or service rather than a person’s inbox. For each sending IP they show how many messages passed or failed SPF, DKIM and alignment.

Spend a few weeks, ideally covering a full month end for the invoicing run, working through the failures:

  • A known service fails: fix its SPF or DKIM setup.
  • An unknown but legitimate service appears: add it to the inventory, authenticate it, or retire it.
  • Sources nobody recognises: that is probably spoofing, which is exactly what DMARC enforcement will stop.

Alignment in Plain Language

A message passes DMARC when SPF or DKIM passes and the domain it passed for matches the visible From domain. With the default relaxed alignment, a subdomain such as mail.example.com aligns with example.com. Strict alignment (adkim=s, aspf=s) requires an exact match. The classic failure: your newsletter tool signs mail with its own domain (d=vendor.example.net). DKIM passes, but nothing aligns with your From domain, so DMARC fails. Fix it by enabling custom domain signing in that tool.

Step 5: Move to Quarantine, Then Reject

When reports show your legitimate mail passing consistently, raise the policy gradually. The pct tag lets you apply it to a share of failing mail first.

_dmarc.example.com.  IN TXT  "v=DMARC1; p=quarantine; pct=25; rua=mailto:[email protected]"
_dmarc.example.com.  IN TXT  "v=DMARC1; p=reject; rua=mailto:[email protected]"

(You publish only one of these at a time, replacing the previous one.) Go from none to quarantine at a low percentage, to full quarantine, and finally to reject. At p=reject, receivers that honour DMARC refuse messages that spoof your domain, which is the point at which invoice fraud using your exact domain becomes hard. It does not stop look-alike domains such as examp1e.com, so register the obvious variants and monitor for new ones.

Do Not Forget the Domains That Never Send Mail

Companies often own dozens of domains: old brands, typo variants, campaign domains. Attackers love them because they are usually unprotected. For every domain that sends no email, publish a lockdown:

parked-example.com.         IN TXT  "v=spf1 -all"
_dmarc.parked-example.com.  IN TXT  "v=DMARC1; p=reject; rua=mailto:[email protected]"
parked-example.com.         IN MX   0 .

The first record says no server may send as this domain, the second tells receivers to reject anything claiming to, and the null MX (0 .) states the domain does not accept mail either. Set it once and forget it.

What Google and Yahoo Changed in 2024

In February 2024, Google and Yahoo began enforcing new requirements for mail sent to their users. They explain why authentication moved from “good practice” to “needed to reach the inbox”:

  • All senders to Gmail need SPF or DKIM, and bulk senders need both.
  • Bulk senders (Google defines this as more than 5,000 messages a day to Gmail addresses) must also publish a DMARC policy, and the visible From domain must align with SPF or DKIM. A policy of p=none is enough to meet the requirement.
  • Marketing and subscribed mail from bulk senders must support one-click unsubscribe (the List-Unsubscribe and List-Unsubscribe-Post headers) and honour requests promptly.
  • Senders must keep the spam complaint rate reported in Google Postmaster Tools low: below 0.1% is the target, and it should never reach 0.3%.

Check each provider’s current published guidelines, since details are updated over time. If you send newsletters or high volume notifications, treat these as minimum standards, not as a finish line.

A Note on BIMI

BIMI (Brand Indicators for Message Identification) lets your logo appear next to your messages in supporting mailboxes. It requires an enforced DMARC policy (quarantine or reject) and, for most providers, a verified mark certificate. It is a branding bonus for organisations that already did the work above, not a security control in its own right.

Rollout Checklist

  1. List every system and vendor that sends email as your domain.
  2. Publish one merged SPF record, staying within 10 DNS lookups.
  3. Enable DKIM signing with your own domain for each service.
  4. Publish DMARC with p=none and an rua address feeding a report tool.
  5. Review reports for at least a few weeks, including month end.
  6. Fix or retire every failing legitimate sender.
  7. Move to p=quarantine, increasing pct, then to p=reject.
  8. Lock down every parked and non-sending domain.
  9. Add the new setup to your onboarding process: no new sending tool goes live without SPF, DKIM and alignment.
  10. Review the reports every month and after every vendor change.

Authentication Protects Your Name, Not Your Inbox

It is important to understand what this work achieves. SPF, DKIM and DMARC protect your outbound reputation and your customers: criminals can no longer convincingly send mail as you. They do nothing about the phishing, spam and malware arriving at your staff.

For the inbound side you need filtering. A gateway such as xQmail, a Dutch spam filter service for businesses, sits in front of your mail platform: you point your MX records at it, suspicious mail is held in quarantine (with periodic quarantine reports and one-click release) and clean mail goes on to your own server, Microsoft 365 or Google Workspace. An optional outbound SMTP relay is available too.

The other half is habit. Every webinar, trade show badge and vendor trial that gets a work address ends up on a list that will be sold or leaked. Encourage staff to sign up with forwarding aliases instead. RedirMe offers private email forwarding aliases that deliver to a real inbox and can be switched off the moment an alias starts attracting spam. Combine that with role addresses (billing@, support@, press@) kept separate from personal mailboxes, so that a leak never exposes the one address that the finance team trusts.

Authentication, filtering and good habits cover three different gaps. Together they make your domain hard to imitate, your inboxes quieter and your invoices harder to fake.

Share this article

About the Author

Sarah Chen

Sarah Chen

Senior Technology Analyst

Senior technology analyst with over 10 years of experience covering enterprise software and AI. Sarah specializes in translating complex technological developments into actionable business insights. Her work has helped countless organizations navigate digital transformation.