SPF, DKIM and DMARC: What They Are and How to Add Them

Updated: 4 December 20264 min read13 viewsMarkdown

SPF, DKIM and DMARC are three DNS records that prove to receiving servers that mail sent in your domain's name really comes from you. Set up together and correctly, they make your mail less likely to land in spam and protect your domain against spoofing.

An envelope passing through three arched checkpoint gates, each with a green tick, on its way to the recipient
Your message passes three checks before it reaches the recipient: SPF, DKIM and DMARC.

What each record does

SPF (Sender Policy Framework)

A TXT record listing which servers may send mail for your domain. The receiving server checks whether a message came from one of them.

DKIM (DomainKeys Identified Mail)

The sending server signs every message with a private key. The public key is published in DNS, and the recipient verifies the signature to confirm the message wasn't altered in transit.

DMARC

Tells receiving servers what to do with mail that fails SPF and DKIM (monitor, send to spam, reject) and, if you like, sends you reports.

Before you start

  • Know where your domain's DNS is managed. If your nameservers point to Voligen, DNS is managed in the Client Area or cPanel; if they point elsewhere, add the records there.
  • List every service that sends mail for your domain: your e-mail service (UltraMail or cPanel hosting), your website, newsletter tool, CRM and so on.
  • The SPF and DKIM values for your service: for UltraMail in the activation e-mail or the admin interface, for cPanel hosting on the Email Deliverability page.

Step-by-step setup

  1. Add the SPF record. In DNS management, add a TXT record at the domain root (@). The value is the SPF string your e-mail service gives you. The general shape is:
Type: TXT   Name: @
v=spf1 a mx include:spf.provider-example.com ~all

The include: part is only an example; take the value for your service from the activation e-mail or the panel. If several services send for you, merge them all into one SPF record.

  1. Enable DKIM. On cPanel hosting, the Email Deliverability page usually sets DKIM up automatically; if your DNS is elsewhere, copy the record it shows and add it there. On UltraMail, generate the key in the DKIM (mail signing) section of the domain administrator settings; the interface shows the record to add:
Type: TXT   Name: selector._domainkey
v=DKIM1; k=rsa; p=MIIBIjANBgkqh...(the long key from the panel)
  1. Add the DMARC record. Start with a monitor-only policy:
Type: TXT   Name: _dmarc
v=DMARC1; p=none; rua=mailto:dmarc@example.com
  1. Verify. Wait for DNS to propagate, then look in the headers of a message you sent to another mailbox for spf=pass, dkim=pass and dmarc=pass. Online SPF/DKIM/DMARC checkers work too.
Three-step flow: adding a new record in the DNS record list, entering the TXT value, all three checks confirmed
1. Open DNS management, 2. add the TXT records, 3. confirm all three checks pass.
Common mistake: two SPF records

A domain can have only one SPF record. Adding a second v=spf1 record makes both invalid. When you add a new sender, edit the existing record.

Tightening the DMARC policy

Collect reports with p=none for a few weeks. Once every legitimate sender passes SPF and DKIM, move to p=quarantine (send to spam) and then, if you wish, p=reject. Starting straight with reject can make mail from a forgotten sender disappear.

Troubleshooting

SymptomLikely causeFix
spf=permerrorTwo SPF records, or a typoMerge into one SPF record and check the syntax.
SPF "too many DNS lookups"The 10-lookup limit is exceededRemove include entries you no longer use.
dkim=failKey copied incompletely, or wrong selector nameCopy the record from the panel again and check the name field.
Website form e-mails land in spamThe web server isn't in SPFSend forms over SMTP, or add the web server to SPF.

Frequently asked questions

Are these records mandatory?

Not technically, but large mailbox providers are increasingly strict with unauthenticated mail. For business sending we recommend all three.

How long until the records take effect?

Usually anywhere from a few minutes to a few hours. It can take longer if the old record had a long TTL.

How do I read DMARC reports?

Reports arrive as XML. Free DMARC report analysers turn them into readable tables.

For delivery problems, also see "Why do my e-mails land in spam?". Our business e-mail plans are on the Business E-mail page; for DNS help, open a support ticket from the Client Area.

Was this article helpful?
Thank you for your feedback.