SPF, DKIM and DMARC are three DNS records that decide whether someone outside your company can send email that appears to come from your domain. Without them, a stranger can send your accounts team a payment request “from the director” and many mail servers will deliver it. This guide explains what each record does, how to check what your domain has today, and how to tighten it step by step without losing real mail.

The short answer

  • SPF lists the servers that may send mail for your domain.
  • DKIM adds a signature to each message that the receiver checks against a key in your DNS.
  • DMARC tells receivers what to do when both checks fail, and sends you reports.
  • Protection starts only when DMARC is set to p=quarantine or p=reject. With p=none you get reports and spoofed mail is still delivered.

What each record does

RecordWhere it lives in DNSWhat it proves
SPFTXT record on the domain itselfThe sending server is on your approved list
DKIMTXT or CNAME record at selector._domainkey.yourdomainThe message was signed by your mail system and not changed on the way
DMARCTXT record at _dmarc.yourdomainWhat receivers should do with mail that fails, and where to send reports

DMARC adds one more condition, called alignment. The domain that passed SPF or DKIM has to match the domain in the From line that the reader sees. That is the part that stops a spoofer who passes SPF with a domain of his own.

Check what your domain has today

From any Linux or macOS terminal, with your own domain in place of ours:

dig TXT yourcompany.com +short
dig TXT _dmarc.yourcompany.com +short

These are the records on our own domain on 13 November 2026:

"v=spf1 include:_spf.mail.hostinger.com ~all"
"v=DMARC1; p=quarantine; rua=mailto:contact@youngstercompany.com; fo=1"

We are on p=quarantine and moving to p=reject after a period of clean reports, which is the same path this guide recommends. If the second command returns nothing, your domain has no DMARC record.

DKIM needs the selector name, which your mail provider shows in its admin console:

dig TXT google._domainkey.yourcompany.com +short

Free tool: our email security checker looks up SPF, DKIM and DMARC for any domain in the browser and explains what is missing.

Step 1: one correct SPF record

Publish one TXT record on the domain that names every service sending mail as you. Your mail provider’s help page gives the exact value. Two common ones:

v=spf1 include:_spf.google.com ~all
v=spf1 include:spf.protection.outlook.com ~all

The rules that catch people out:

  • A domain may have only one SPF record. Two records make SPF fail for everything. If you use two services, put both include: parts in the same record.
  • SPF allows at most 10 DNS lookups. Every include: counts, and the ones inside it count too. Remove services you no longer use.
  • ~all marks other servers as a soft fail and -all as a hard fail. Start with ~all and move to -all once DMARC is at reject and the reports are clean.

Step 2: turn on DKIM signing

You switch DKIM on in your mail provider’s admin console. The console gives you a record to add in DNS, and signing starts after you confirm it. In Google Workspace it is under Apps, Google Workspace, Gmail, Authenticate email. In Microsoft 365 it is in the Defender portal under Email authentication settings.

Do the same in every other system that sends as your domain: the invoicing tool, the newsletter service, the website’s contact form. Each has its own DKIM setting. Mail from a system without it will fail once DMARC is enforced.

Step 3: DMARC, from none to reject

Start with a record that changes nothing for delivery and asks for reports:

v=DMARC1; p=none; rua=mailto:dmarc@yourcompany.com

Add it as a TXT record with the name _dmarc. Receivers such as Google and Microsoft then send a daily XML report to that address, listing every server that sent mail as your domain and whether it passed.

  1. Stay on p=none for two to four weeks and read the reports. Each sender you recognise that fails needs its SPF or DKIM fixed.
  2. Move to p=quarantine. Failing mail now goes to spam.
  3. When the reports stay clean for a few weeks, move to p=reject. Receivers refuse failing mail.
TagMeaning
pPolicy for the domain: none, quarantine or reject
spPolicy for subdomains, if it should differ
ruaAddress for the daily summary reports
pctShare of failing mail the policy applies to, useful for a gradual move
fo=1Ask for a failure report when either SPF or DKIM fails

Why this is no longer optional

Since February 2024, Google requires SPF or DKIM from every sender to Gmail addresses, and SPF, DKIM and a DMARC record from anyone sending 5,000 or more messages a day. Yahoo applies similar rules. Mail that fails bounces or lands in spam, so a missing record now costs you delivered invoices and password resets as well as security.

For a small business the bigger risk is fraud. A spoofed mail from a director’s address is the usual start of a fake payment request. With DMARC at reject, the receiving server refuses that mail before anyone can act on it. Lookalike domains are a separate problem, and staff training still matters.

Mistakes we see most

  • DMARC left on p=none for years. It reports and protects nothing.
  • Two SPF records after a move to a new mail provider.
  • The DMARC record published on the wrong name. It must be at _dmarc.yourcompany.com.
  • A forgotten sender, such as the billing system, that starts failing when the policy is tightened. The p=none weeks exist to find these.
  • Domains that send no mail left open. For those, publish v=spf1 -all and v=DMARC1; p=reject so nobody else can use them.

Free guide: email authentication is one of the checks in our 10 security checks you can run today.

Related guides

Sources

Want your mail setup reviewed? Our VAPT services cover mail authentication, sign-in and sharing settings. Contact us for a quote.

Post author avatar

Bhaskar Soni

Bhaskar Soni is a Security Engineer and the founder of Youngster Company, based in Ahmedabad, Gujarat. He works hands-on with Linux server hardening, vulnerability assessment and penetration testing (VAPT), ISO 27001 compliance and OSINT investigations. He writes practical, tested guides for IT professionals and Indian businesses, and every article on this site is written or reviewed by him.

Leave a Reply