Free site migration on web hosting plans

ADVEYER
USD / TRYToday's rate (25 November 2026). TRY prices are worked out with it. 50.51 ₺

SPF, DKIM and DMARC Explained: Fixing Business Email Authentication

Mail landing in spam, or someone spoofing your domain? SPF, DKIM and DMARC are the three DNS records behind both problems. Here is how they work.

Estimated Time
7 minutes
Difficulty
Intermediate
Steps
5 steps
Published
Last Updated
On This Page

You send a quote to a customer and it ends up in their spam folder. Or the opposite happens: a message you never wrote is going around under your domain name. Both problems usually come from the same gap: the domain's email authentication (SPF, DKIM and DMARC) is missing or incomplete.

Below is what each record does and the order in which to add them to DNS without breaking your own mail.

What Each Record Does

Email was designed at a time when nobody checked whether the sender was who they claimed to be. Receiving servers now close that gap by looking at three DNS records. All three are published as TXT records in your domain's DNS zone.

  • SPF lists the servers allowed to send mail for your domain.
  • DKIM adds a digital signature to each outgoing message. The receiver checks it against a public key in your DNS, which shows the message was not altered in transit.
  • DMARC reads the SPF and DKIM results and tells the receiver what to do on failure: accept, send to spam, or reject. It also sends you reports.

Put simply: SPF answers "who may send", DKIM answers "is this message really from us and unchanged", and DMARC answers "what happens if the checks fail".

The SPF Record

SPF is defined in RFC 7208 (opens in a new tab). It is a single TXT record at the root of your domain. For example:

text
example.com.  IN  TXT  "v=spf1 mx include:_spf.mailprovider.example ~all"

Read it from left to right:

  • v=spf1 marks it as an SPF record.
  • mx allows the servers listed in your MX records to send mail.
  • include: pulls in another service's SPF record, such as a newsletter tool.
  • ~all treats everyone else as suspicious (softfail). -all means reject.

Under RFC 7208, SPF evaluation may trigger at most 10 DNS lookups (mechanisms such as include, a and mx count). Stack too many include entries and SPF returns a "permerror". Remove services you no longer use.

The DKIM Signature

DKIM is defined in RFC 6376 (opens in a new tab). Your mail server signs every outgoing message with a private key. The matching public key is published in DNS under a selector name:

text
mail1._domainkey.example.com.  IN  TXT  "v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQ..."

Here mail1 is the selector, and it can be any name. A domain can use several selectors, which lets you rotate keys while the old one stays valid for a while.

Things to watch with DKIM:

  • Your control panel or mail server generates the public key. You only copy it into DNS. Do not shorten or split the value by hand.
  • Some DNS panels split long TXT values automatically. After saving, check that the value is complete.
  • If a third-party service sends mail for you, it will give you its own DKIM record, and you need to add that one too.

The DMARC Policy

DMARC is defined in RFC 7489 (opens in a new tab). At least one of SPF or DKIM must pass and the authenticated domain must align with the domain in the visible From address. The record is published under the _dmarc name:

text
_dmarc.example.com.  IN  TXT  "v=DMARC1; p=none; rua=mailto:dmarc@example.com"

The p= policy takes one of three values:

Policy Meaning
none Take no action, just send reports.
quarantine Treat failing mail as suspicious, usually the spam folder.
reject Refuse failing mail outright.

The rua= tag is the address for daily aggregate reports. They show which IPs send mail for your domain, which is how you catch a forgotten service or a spoofing attempt.

The Right Order to Set It Up

Do not set DMARC to reject on day one. If a legitimate sender such as an invoicing tool, a newsletter service or a CRM is missing from SPF and DKIM, its mail will be lost. Follow this order:

0 of 5 steps done

  1. Step 1: List Every Source That Sends Mail

    Your mail server, the contact form on your website, a newsletter service, accounting or CRM software: write down everything that sends mail under your domain.

  2. Step 2: Write the SPF Record

    Combine the sources into one SPF record. Start with ~all.

  3. Step 3: Turn on DKIM

    Enable DKIM signing on your mail server and on third-party services, and add the public keys they give you to DNS.

  4. Step 4: Start DMARC with p=none

    Watch the reports for a few weeks. If you see a source you did not expect, fix that first.

  5. Step 5: Tighten the Policy Step by Step

    Once the reports are clean, move to quarantine, then to reject.

After adding the records, send a test message from another address, for example to Gmail. In the "Show original" view you should see PASS for SPF, DKIM and DMARC.

Why It Is Now Expected

Google requires SPF, DKIM and DMARC from senders that send more than 5,000 messages a day to Gmail addresses, and it also expects spam complaint rates to stay low. A small business may sit below that threshold, but receiving servers weigh the same signals when they judge trust. See Google's email sender guidelines in the sources below for details.

Common Mistakes

  • Several SPF records: adding one per service. Merge them into a single record.
  • Going over the 10-lookup limit: piling up unnecessary include entries.
  • Pasting a truncated DKIM key: if part of the long key is cut off, the signature will not verify.
  • Never reading DMARC reports: leaving p=none forever and never looking makes the record pointless.
  • Forgetting subdomains: if a subdomain such as news.example.com sends mail, check its records too.
  • Not allowing for DNS delay: new records can take a few hours to show up because of DNS caches.

If you get stuck during setup, our 7/24 WhatsApp and email support is there to help. For the groundwork on the domain side, see the Domain page, and for the mail service see Business Email.

Business Email

Email on your own domain with antispam protection

Starting Price

$4.99/mo

View Plans

Frequently Asked Questions

Do I need all three of SPF, DKIM and DMARC?

Yes, they work together. SPF checks the sending server, DKIM checks the message was not altered, and DMARC combines both results and tells the receiver what to do. Protection is weaker if one is missing.

Can I set DMARC straight to reject?

You can, but we do not recommend it. Start with p=none and read the reports. When every legitimate sender passes SPF or DKIM, move to quarantine and then to reject.

What happens if my domain has two SPF records?

The SPF result is treated as invalid and checks may fail. Merge all sending sources into one v=spf1 record.

When do new records take effect?

DNS caches can delay it by a few hours. Then send yourself a test message and check the SPF, DKIM and DMARC results in the message headers.

Sources

Was This Guide Helpful?

Related Guides