How to Set Up DKIM, SPF, and DMARC in cPanel to Stop Emails Going to Spam

Priya

Content Writer & Researcher

Last Updated: 30 September 2026
How to Set Up DKIM, SPF, and DMARC in cPanel to Stop Emails Going to Spam
🖥️

Stop Your cPanel Emails From Landing in Spam

Misconfigured DKIM, SPF, or DMARC costs you deliverability every day. CloudHouse's server management team will audit your email authentication, fix the records, and monitor your sender reputation — so your emails reach the inbox, not the junk folder.

🖥️12,400+PCs Fixed
⭐4.9★Google Rating
⚡<15 minAvg. Response
🛡️ISO 27001Certified

If your cPanel emails are landing in spam or getting rejected outright, the problem is almost certainly missing or broken email authentication. DKIM, SPF, and DMARC are the three DNS-based standards that tell receiving mail servers "this email is really from us." Without them, even legitimate business emails get flagged as suspicious.

This guide walks cPanel server administrators through setting up all three authentication methods correctly — and covers the troubleshooting steps competitors skip when the cPanel "Repair" button doesn't solve the problem.

What Is Email Authentication and Why It Matters?

Major inbox providers — Gmail, Outlook, Yahoo — now require proper email authentication. Since Google and Yahoo's 2024 bulk sender requirements, missing SPF or DKIM causes immediate deliverability failures. DMARC adds a policy layer that tells receiving servers what to do when authentication fails.

Here's what each record does:

  • SPF (Sender Policy Framework) — A DNS TXT record that lists which mail servers are allowed to send email for your domain
  • DKIM (DomainKeys Identified Mail) — Adds a cryptographic signature to outgoing emails, proving they haven't been tampered with in transit
  • DMARC (Domain-based Message Authentication, Reporting and Conformance) — A policy that tells receiving servers what to do (nothing, quarantine, or reject) when SPF or DKIM fails

All three must be correctly configured for reliable email delivery from your cPanel server.

💡 None of these worked? Skip the guesswork.

Get Expert Help →

Step 1: Enable DKIM in cPanel

cPanel automatically generates DKIM keys when the feature is enabled. Here's how to verify and enable it:

1Log into WHM as root

Navigate to WHM > Home > Service Configuration > Exim Configuration Manager. Under the "Security" section, ensure "DKIM (DomainKeys Identified Mail) Support" is enabled.

2Generate DKIM keys per domain in cPanel

In cPanel (per-account), go to Email > Email Deliverability. This is cPanel's unified deliverability tool. You'll see each domain listed with a status indicator — green check means DKIM is properly configured, red means action is needed.

3Use the Repair button

Click "Repair" next to any domain showing issues. cPanel will attempt to automatically install DKIM, SPF, and PTR records if they are missing or misconfigured.

4Verify the DKIM DNS record

After repair, the DKIM record should appear as a TXT record in your DNS zone:

default._domainkey.yourdomain.com  TXT  "v=DKIM1; k=rsa; p=MIIBIjANBg..."

The selector is default by default in cPanel. If your domain uses an external DNS provider (Cloudflare, GoDaddy), you must manually copy this record into their DNS management panel — cPanel cannot auto-install it to external DNS.

1Check your current SPF record

In cPanel, go to Email > Email Deliverability and look at the SPF status. Alternatively, check via DNS lookup:

dig TXT yourdomain.com | grep spf
2Standard cPanel SPF record format
v=spf1 +a +mx +ip4:YOUR.SERVER.IP ~all

If you send email through third-party services (Google Workspace, Mailchimp, Mailgun), add their include statements:

v=spf1 +a +mx +ip4:YOUR.SERVER.IP include:_spf.google.com include:mailgun.org ~all
3Critical: Only one SPF record per domain

This is the most common mistake. If you have multiple TXT records starting with v=spf1, receiving servers will reject your emails. You must merge all allowed senders into a single SPF record. Having two SPF records causes a "SPF PermError" which fails authentication.

4Understand the ending qualifiers
  • ~all (softfail) — Suspicious emails still delivered but marked as spam. Good starting point.
  • -all (hardfail) — Emails from unlisted servers are rejected outright. Use after confirming all senders are listed.
  • ?all (neutral) — No policy. Do not use — it provides no protection.
1Add DMARC as a DNS TXT record

In cPanel, go to Domains > Zone Editor, select your domain, and click Add Record > Add TXT Record.

  • Name: _dmarc.yourdomain.com
  • TTL: 3600
  • Type: TXT
  • Value: See below
2Start with a monitoring-only DMARC policy
v=DMARC1; p=none; rua=mailto:dmarc-reports@yourdomain.com; ruf=mailto:dmarc-reports@yourdomain.com; fo=1

p=none means no action is taken — emails still deliver normally. The rua tag sends aggregate reports to your email address daily, showing which sources are sending email on behalf of your domain.

3Progress to enforcement after 2-4 weeks

Once you've reviewed DMARC reports and confirmed all legitimate mail sources are authenticated, move to a quarantine or reject policy:

v=DMARC1; p=quarantine; pct=50; rua=mailto:dmarc-reports@yourdomain.com

The pct=50 parameter applies the policy to only 50% of failing emails, letting you test enforcement gradually before moving to p=reject.

1Use mail-tester.com — Send an email to their test address and receive a score out of 10. A properly configured server should score 9-10.

2. Check via command line

# Check SPF
dig TXT yourdomain.com

# Check DKIM
dig TXT default._domainkey.yourdomain.com

# Check DMARC
dig TXT _dmarc.yourdomain.com

3. Send a test to Gmail — Open the email in Gmail, click the three-dot menu > "Show original." Look for dkim=pass, spf=pass, and dmarc=pass in the Authentication-Results header.

Common Mistakes to Avoid

  • Multiple SPF records — Always merge into one. Never add a second v=spf1 record.
  • Too many SPF lookups — SPF allows a maximum of 10 DNS lookups. Each include: statement uses one. Exceeding 10 causes an SPF PermError.
  • Jumping straight to DMARC p=reject — Start with p=none for 2-4 weeks and review reports before enforcing.
  • Forgetting subdomain DMARC — Add sp=reject to your DMARC record to apply policy to subdomains: v=DMARC1; p=reject; sp=reject; rua=mailto:...
  • Not checking DMARC reports — The aggregate reports (rua) reveal legitimate services sending unauthenticated email. Review them before enforcing policy.

FAQs

How long does it take for DKIM and SPF changes to take effect?

DNS changes typically propagate within 15 minutes to 4 hours. However, if your domain's previous TTL was set high (86400 seconds = 24 hours), the old records may be cached for up to 48 hours. Always lower your TTL to 300 seconds before making DNS changes to speed up propagation.

Can I have SPF set up for multiple mail providers in cPanel?

Yes. Merge all providers into a single SPF record using multiple include: statements: v=spf1 +a +mx include:_spf.google.com include:mailgun.org +ip4:YOUR.IP ~all. Remember the 10 DNS lookup limit — if you're approaching it, use SPF flattening tools to consolidate.

Why does Gmail still show "via" or "on behalf of" even with DKIM enabled?

The "via" label appears when the DKIM signature domain (d= tag) doesn't match the From: address. In cPanel, ensure DKIM is enabled for the exact domain used in your From: address. If using a marketing platform like Mailchimp, you need to set up domain authentication within that platform, not just in cPanel.

What's the difference between SPF softfail (~all) and hardfail (-all)?

Softfail (~all) tells receivers the email is suspicious but still allows delivery — most receivers mark it as spam. Hardfail (-all) instructs receivers to reject emails from unlisted senders outright. Start with softfail until you're confident all your legitimate mail servers are listed in SPF, then switch to hardfail.

My cPanel DKIM repair shows "success" but emails still go to spam. What next?

Check three things: (1) Your domain uses external DNS and the DKIM record wasn't auto-installed — verify the record actually exists using dig TXT default._domainkey.yourdomain.com. (2) Your server IP is on a blacklist — check MXToolbox. (3) Your email content or sender reputation is the issue, not authentication — review mail-tester.com for content-based spam triggers.

Get the Free Linux Server Admin Cheatsheet (PDF)

Essential commands for server management, networking, and troubleshooting — all on one printable page.

Running Linux servers? Let us manage them for you.

Our Managed Linux Server plans cover updates, security hardening, monitoring, and 24/7 incident response — so your servers stay up and your team stays focused.

  • Proactive OS patching and security updates
  • 24×7 monitoring with instant alerting
  • Backup configuration and disaster recovery
  • Dedicated Linux engineers on call
See Pricing Plans →

What our customers say

“Our production server went down at 2 AM. CloudHouse had it back online in under 20 minutes. Incredible response time.”

Arun S.

CTO, SaaS Startup

“They migrated our entire infrastructure from Ubuntu 18 to 22 with zero downtime. Couldn't have asked for better.”

Deepak N.

DevOps Lead

Frequently Asked Questions

DNS changes typically propagate within 15 minutes to 4 hours. However, if your domain's previous TTL was set high (86400 seconds), the old records may be cached for up to 48 hours. Always lower your TTL to 300 seconds before making DNS changes to speed up propagation.

Need this done for you?

Google Workspace and Email Setup

Workspace, Microsoft 365 and email deliverability set up correctly.

Learn more

Book your free 15-minute diagnosis

A certified technician will call you back within 15 minutes during business hours.

Share this article

Leave a Comment

Comments (0)

Loading comments...