HiBlog Hosting and cPanel

How to Set Up SPF, DKIM and DMARC in cPanel: What Each Record Does

  • Ali GhanimatiAuthor
  • Last updated
  • 6 minutesReading time
  • 383Views
  • Ali Ghanimati
  • Last updated:
  • 6 min read
  • 383 views
How to Set Up SPF, DKIM and DMARC in cPanel: What Each Record Does

You send order invoices from your site’s email, but customers say the message went to spam or never arrived. Or worse: one day someone sent fake messages to your customers from your domain’s address, and now you have to explain it wasn’t you! In both cases, the first thing to check is three DNS records: SPF, DKIM and DMARC.

In this article we explain in plain words what each of these records is and what it does, then walk you through setting up DKIM, SPF and DMARC in cPanel step by step, and finally show you how to check that all three work.

Short answer: SPF says which servers may send email on behalf of your domain, DKIM adds a digital signature to every message and DMARC tells the receiving server what to do with a message that fails these two checks. In cPanel, open Email Deliverability in the Email section, click Manage and click Install the Suggested Record for all three records.

What are SPF, DKIM and DMARC, and why do you need them?

The email protocol by itself doesn’t check that a sender really is who they claim to be. These three records fill that gap, and today they are no longer optional: under Gmail’s sender guidelines, anyone sending to Gmail must have at least SPF or DKIM, and senders who send more than 5,000 messages a day to Gmail need all three.

What is an SPF record?

SPF (Sender Policy Framework) is a TXT record on the domain itself that lists the servers allowed to send email for the domain. An SPF record lets the receiving server see whether a message came from one of those servers or from somewhere else. An example:

v=spf1 +a +mx +ip4:203.0.113.10 include:_spf.example.net ~all

At the end of the record, ~all means mail from other servers is suspicious and -all means reject it. A domain can have only one SPF record; if you send through several email services, put them all in that one record with include.

What is a DKIM record?

DKIM (DomainKeys Identified Mail) adds a digital signature to every message your server sends. The private signing key stays on the server, and its public key is published in a TXT record in DNS; in cPanel it is named default._domainkey. The receiving server checks the signature with that public key and knows the message really came from your domain and wasn’t altered on the way.

What is a DMARC record?

DMARC is a TXT record named _dmarc that does two things: it tells the receiving server what to do with a message whose SPF and DKIM don’t line up with the sender’s domain, and asks it to send reports of these checks to an address you choose. A DMARC policy has three modes: p=none only reports, p=quarantine sends suspicious mail to spam and p=reject rejects it.

Setting up SPF and DKIM in cPanel

cPanel gathers all these records in its Email Deliverability tool and suggests the right value for each one:

Log in to cPanel and click Email Deliverability in the Email section.

Email Deliverability in cPanel’s Email section

In the list of domains, the Email Deliverability Status column shows which records have problems; for example, Problems Exist (DMARC, DKIM, and SPF). Click Manage next to the domain.

Problems Exist status and the Manage button in Email Deliverability

On the page that opens:

  1. In the DKIM section, click Install the Suggested Record. If no key has been made yet, click Generate Local DKIM Key first.
  2. In the SPF section, click Install the Suggested Record too. If you also send email through another service, such as a newsletter service, use Customize to add that service’s include address and then click Install a Customized SPF Record.

These buttons only publish the record when the domain’s nameservers point to this host. If the domain’s DNS is at Cloudflare or your domain panel, use the Copy button to take the Name and Value and create the same record there. DNS changes can take up to 24 hours to be seen everywhere.

Setting up DMARC in cPanel

In recent versions of cPanel, the DMARC section is on the same Manage page and is created with Install the Suggested Record. Just remember that DMARC only works when the domain’s SPF and DKIM are valid; so fix those two first.

If you want to write DMARC yourself, with reporting, open Zone Editor in the Domains section.

Zone Editor in cPanel’s Domains section
  1. Click Manage next to the domain, then + Add Record.
  2. Enter _dmarc as the Name; cPanel adds the domain name to it by itself.
  3. Set the record type to TXT, enter the value below with your own email address in Record and click Save Record.
v=DMARC1; p=none; rua=mailto:dmarc@yourdomain.com
Creating a TXT record named _dmarc in Zone Editor

Start with p=none and read the reports arriving at the rua address for a few weeks. Once you see that all your real senders pass SPF and DKIM, move the policy to p=quarantine and then p=reject. If you set reject from day one and forgot a service, your own emails get rejected!

Test the records

Send a message from your domain’s email to a Gmail address. In Gmail, open the message, choose Show original from the three-dot menu and check that SPF, DKIM and DMARC say PASS. If one says FAIL, go back to Email Deliverability and compare cPanel’s suggested value with the record that’s actually in DNS.

Common mistakes

  • Two SPF records: if you have two TXT records starting with v=spf1, the domain’s SPF fails entirely. Merge them into one record.
  • Too many includes: an SPF check allows at most 10 DNS lookups; remove the includes of services you no longer use.
  • The record in the wrong place: a record created in cPanel has no effect when the nameservers are somewhere else.
  • Forgetting other services: a newsletter service, online shop or CRM sending on behalf of your domain must be covered by SPF and DKIM too.

FAQ

With these three records set, will my emails stop going to spam?

These records are necessary, not sufficient. The content of the message, the quality of your recipient list and the server IP’s reputation also affect the receiving server’s decision. But without them, your emails go to spam or get rejected much sooner.

Does a domain that never sends email need these records too?

Yes, so that nobody can forge email in its name. For such a domain, set the SPF record to v=spf1 -all and the DMARC record to v=DMARC1; p=reject.

Professional email with HiData hosting

On HiData’s professional cPanel hosting, Email Deliverability and Zone Editor are right in your cPanel, and you create all three records in a few clicks. No domain email yet? See How to Create a Domain Email in cPanel, and if you get stuck, our 24/7 ticket support is there for you!

Share Post

hidata.org/en/blog/how-to-set-dkim-spf-and-dmarc-records-on-domain-in-cpanel/
In Social Media

Add Comment

Related Articles