New guide: how to warm up a dedicated IP without hurting your reputation. Read now →
Log in
MigoSMTP
AuthenticationUpdated 15 Oct 2026

DKIM, SPF and DMARC: a complete setup guide

Three DNS records decide whether mailbox providers trust your domain. Here is how each one works and how to publish it correctly.

IR
Written by Ishita Rao
Email Authentication Engineer
Reviewed by Amara Okafor
  • Published14 Apr 2026
  • Read time4 min
  • Length777 words
Share this guide

At a glance. Time needed: About 30 minutes, plus DNS wait · You will need: Access to your DNS provider

The short version

  1. Why three records. SPF, DKIM and DMARC each answer a different question.
  2. SPF: list who may send. SPF is a TXT record on your domain that lists the servers allowed to send its mail.
  3. DKIM: sign every message. DKIM adds a cryptographic signature to each message.
  4. DMARC: set the policy. DMARC ties the other two together.
  5. Alignment in plain words. DMARC passes when either SPF or DKIM passes and the domain it checked matches the domain in your From address.
  6. Verify and monitor. Send a test message to a mailbox you control and read the authentication results in the headers of the received copy.

Why three records

SPF, DKIM and DMARC each answer a different question. SPF asks whether the sending server is allowed to send for the domain. DKIM asks whether the message was signed by the domain and not changed on the way. DMARC asks what the receiver should do when those checks fail, and tells you about it.

Mailbox providers now expect all three, especially from senders of high volume. Publishing them also protects your own domain from being forged in phishing attempts.

SPF: list who may send

SPF is a TXT record on your domain that lists the servers allowed to send its mail. Publish one SPF record per domain and include the value shown in your MigoSMTP dashboard in it. The ending ~all marks other senders as suspect; some teams later move to -all once they are sure every legitimate sender is listed.

v=spf1 include:YOUR_SPF_HOST ~all

Keep the record under ten DNS lookups. Every include counts toward the limit, so remove providers you no longer use. Two separate SPF records on one domain is an error and makes SPF fail.

DKIM: sign every message

DKIM adds a cryptographic signature to each message. The receiver checks it against a public key that you publish in DNS under a selector name. MigoSMTP gives you the exact records to add, usually one or more CNAME or TXT records.

SELECTOR._domainkey.example.com  CNAME  YOUR_DKIM_TARGET

Add the records exactly as shown in your dashboard, then verify. Use a separate selector for each sending service so you can rotate or remove one without touching the others.

DMARC: set the policy

DMARC ties the other two together. It tells receivers what to do when a message fails both SPF and DKIM alignment with your visible From domain, and where to send reports about it.

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

Start at p=none with reporting turned on, read the reports to find every legitimate sender, fix the gaps, then move to quarantine and finally reject. Going straight to reject can block your own legitimate mail.

Alignment in plain words

DMARC passes when either SPF or DKIM passes and the domain it checked matches the domain in your From address. For DKIM, that is the domain in the signature. For SPF, it is the envelope sender domain, not the From address.

This is why sending from your own domain, with DKIM signed for that domain, is more robust than relying on a shared domain. If your DMARC checks fail even though SPF and DKIM pass, alignment is the usual cause.

Verify and monitor

Send a test message to a mailbox you control and read the authentication results in the headers of the received copy. You should see spf=pass, dkim=pass and dmarc=pass. You can also query your records directly.

dig +short TXT example.com
dig +short TXT _dmarc.example.com
dig +short CNAME SELECTOR._domainkey.example.com

Keep monitoring. DNS changes made for other tools can break your records without warning, and new senders appear over time. Review DMARC reports regularly.

Common mistakes

Publishing two SPF records, going over ten DNS lookups, adding the DMARC record on the wrong host name, letting your DNS provider split or alter long TXT values, and forgetting subdomains that also send mail.

If verification fails, run the authentication checker on the domain to see what the rest of the internet sees, and wait for DNS changes to spread before you retry.

Further reading and sources

Not sure your records are right? Run our free checker, or send us a header and we will help you read it.

Start free

Frequently asked questions

Do I need SPF, DKIM and DMARC?

If you send at any scale, yes. Gmail and Yahoo expect authentication, and together the three records let receivers verify that mail really comes from you.

What is the order to set them up?

Start with SPF and DKIM for each sender, then publish DMARC at p=none, read the reports, fix failures and tighten the policy in stages.

What is DMARC alignment?

The domain that passed SPF or DKIM must match the domain in the From header. Without alignment, DMARC fails even when SPF and DKIM pass.

How do I check my records?

Use our SPF, DKIM and DMARC checker, then send a test message and read the Authentication-Results header.

Topics#dkim#spf#dmarc#authentication
Was this guide helpful?Your answer helps us improve our documentation.

Start sending in minutes.

Create an account, add your domain and send your first email.

Get started Talk to sales