Guide

Protect against email spoofing: SPF, DKIM and DMARC fully explained

SPF, DKIM, DMARC: these three abbreviations are what make Gmail/Outlook treat your email as trustworthy. If they are not set up, the mail you send to customers lands in the SPAM folder or doesn't arrive at all. In this guide yo...

  • Step by step, written for beginners
  • Reading time: 5 min
  • Support 09:00-03:00 if you have a question
?

Get your emails out of the spam folder

SPF, DKIM, DMARC: these three abbreviations are what make Gmail/Outlook treat your email as trustworthy. If they are not set up, the mail you send to customers lands in the SPAM folder or doesn't arrive at all. In this guide you will learn to set up all three in 15 minutes.

1

Why do these 3 protocols matter?

The main problem with email is that it has no identity verification at the protocol level. Anyone can send mail from any “From” address (e.g. info@yourbank.com). This is called spoofing.

These three protocols, SPF, DKIM and DMARC, solve this problem:

  • SPF: a list answering “which servers may send mail for this domain?”
  • DKIM: verifies the digital signature (does the mail really come from the genuine sender?)
  • DMARC: what the receiver should do if SPF/DKIM fails (reject, quarantine, accept)
⚠️

Important since 2024: Google and Yahoo require DMARC from anyone who sends 5000+ emails a day. Without it your mail doesn't go to spam, it never arrives at all.

2

SPF: Sender Policy Framework

SPF lives in DNS as a TXT record. It is the list of servers that may send mail on behalf of your domain.

A typical SPF record

  • Type: TXT
  • Host: @ (meaning the domain itself)
  • Value: v=spf1 +a +mx +ip4:203.0.113.10 ~all

Explanation

  • v=spf1: the SPF v1 protocol
  • +a: the IP in the domain's A record is allowed
  • +mx: the servers in the domain's MX record are allowed
  • +ip4:...: a specific IP is allowed
  • ~all: everything else is a “soft fail” (goes to spam)

If you use Google Workspace

v=spf1 include:_spf.google.com ~all

For Microsoft 365: v=spf1 include:spf.protection.outlook.com ~all

?

One SPF record per domain: don't add a 2nd SPF record. Combine all the includes in a single record.

3

DKIM: DomainKeys Identified Mail

DKIM is a cryptographic signature that the sending server adds to the mail. The receiving server checks this signature against the public key in your DNS.

Setting it up in cPanel

On Hostinq.com hosting, cPanel can create the DKIM key for your domain, and Email Deliverability shows whether the record is in place and can set it up for you. To check:

  1. Go to cPanel → Email Deliverability
  2. Select your domain
  3. SPF and DKIM should show the “Valid” status
  4. If there is a “Repair” button, press it (any problem is fixed automatically)

DKIM record example

  • Type: TXT
  • Host: default._domainkey
  • Value: v=DKIM1; k=rsa; p=MIGfMA0G... (a long public key)
4

DMARC: the policy layer

DMARC tells the receiver what to do based on the results of SPF and DKIM.

DMARC record

  • Type: TXT
  • Host: _dmarc
  • Value: v=DMARC1; p=quarantine; rua=mailto:postmaster@yoursite.com; pct=100

Policy options

  • p=none: monitor only (for beginners)
  • p=quarantine: mail that fails SPF/DKIM goes to spam
  • p=reject: mail that fails is rejected completely (professional)

Recommendation: start with p=none, look at the reports for 1 month, and if everything is OK switch to p=quarantine.

Aggregate reports

rua=mailto:postmaster@yoursite.com: the daily DMARC report arrives at this email address. It is a list of “who sent mail in your name and what the result was”.

5

Setting it up in cPanel in 3 minutes

  1. cPanel → Email Deliverability
  2. Find your domain
  3. Press the “Manage” button
  4. Check the SPF and DKIM statuses
  5. If you see yellow/red, press “Repair”: it fixes itself automatically

Adding DMARC manually

cPanel does not set up DMARC automatically, so you add it manually:

  1. cPanel → Zone Editor
  2. Press “Manage” on your domain
  3. Add Record → TXT
  4. Name: _dmarc
  5. TTL: 3600
  6. Record: v=DMARC1; p=quarantine; rua=mailto:postmaster@yoursite.com
  7. Save
6

Checking

Check with 3 online tools:

1. Mail-tester.com

mail-tester.com: you send a test mail to the email address the site gives you, and it gives a rating of up to 10/10. 8+ is good.

2. MXToolbox

mxtoolbox.com: enter your domain and it scans all your DNS records. You should see “Pass” for SPF, DKIM and DMARC.

3. Google Postmaster Tools

Permanent monitoring: postmaster.google.com. Statistics on the reputation, spam rate and authentication of the mail you send to Gmail.

?

DNS propagation: After making a change, wait 1-24 hours. If you test too early, you will still see the old record.

FAQ

If I have SPF, why do I need DKIM and DMARC?

SPF only checks “from which IP”, not the content. DKIM signs the content as well. DMARC sets the rules if both fail. All three together = maximum protection.

My email goes to spam: how do I fix it?

1) Set up SPF, DKIM and DMARC, 2) Check your IP reputation (mxtoolbox), 3) Don't use “spam” words in the content (“100% free!”, “Buy now!”), 4) Get a score of 8+ in Mail-tester.

I use a third-party email service (Mailchimp): how do I add it?

Add their SPF includes to your SPF: v=spf1 include:_spf.google.com include:servers.mcsv.net ~all

I only have one site: why do I need these?

It matters even if a business site sends an invoice email to just 1 customer. Otherwise the customer says “no mail came from you”, when in fact it landed in spam.

Email solutions at Hostinq.com

Mailboxes on your own domain are included in every hosting plan, and cPanel Email Deliverability helps you set up SPF and DKIM.

View corporate mail plans