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=quarantineorp=reject. Withp=noneyou get reports and spoofed mail is still delivered.
What each record does
| Record | Where it lives in DNS | What it proves |
|---|---|---|
| SPF | TXT record on the domain itself | The sending server is on your approved list |
| DKIM | TXT or CNAME record at selector._domainkey.yourdomain | The message was signed by your mail system and not changed on the way |
| DMARC | TXT record at _dmarc.yourdomain | What 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 +shortThese 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 +shortFree 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 ~allThe 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. ~allmarks other servers as a soft fail and-allas a hard fail. Start with~alland move to-allonce 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.comAdd 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.
- Stay on
p=nonefor two to four weeks and read the reports. Each sender you recognise that fails needs its SPF or DKIM fixed. - Move to
p=quarantine. Failing mail now goes to spam. - When the reports stay clean for a few weeks, move to
p=reject. Receivers refuse failing mail.
| Tag | Meaning |
|---|---|
| p | Policy for the domain: none, quarantine or reject |
| sp | Policy for subdomains, if it should differ |
| rua | Address for the daily summary reports |
| pct | Share of failing mail the policy applies to, useful for a gradual move |
| fo=1 | Ask 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=nonefor 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=noneweeks exist to find these. - Domains that send no mail left open. For those, publish
v=spf1 -allandv=DMARC1; p=rejectso 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
- Your Vendor Had a Data Breach: What to Do in the First 48 Hours
- Web Application VAPT: Scope, Steps and Report
- Secure Nginx Configuration for Production
Sources
- RFC 7208: Sender Policy Framework (SPF)
- RFC 6376: DomainKeys Identified Mail (DKIM) Signatures
- RFC 7489: Domain-based Message Authentication, Reporting, and Conformance (DMARC)
- Google: Email sender guidelines
Want your mail setup reviewed? Our VAPT services cover mail authentication, sign-in and sharing settings. Contact us for a quote.
