What Is cPanel Email Routing and Why Does It Break?
cPanel Email Routing is the server-level setting that tells Exim (the mail transfer agent behind every cPanel server) where to deliver incoming mail for your domain. The setting lives under cPanel > Email > Email Routing and offers four modes: Automatically Detect Configuration, Local Mail Exchanger, Backup Mail Exchanger, and Remote Mail Exchanger.
When this is misconfigured — or when email forwarders interact badly with modern authentication standards — your messages silently vanish, bounce, or land in spam. Since Google and Yahoo enforced strict DMARC/DKIM/SPF requirements in 2024 and tightened them further in 2025–2026, email routing and forwarding failures have become one of the top support tickets on cPanel servers worldwide.
This guide covers the full diagnostic and fix path: from checking routing mode to repairing SPF/DKIM alignment, fixing the Exim queue, and making forwarders reliable again.
Step 1: Check Your Current Email Routing Mode
Log in to cPanel and navigate to Email > Email Routing. You will see the current setting for each domain. The correct setting depends on where your MX records point:
- Local Mail Exchanger — Use this when your MX records point to this server. All mail is delivered locally.
- Remote Mail Exchanger — Use this when your MX records point to an external provider (Google Workspace, Microsoft 365, Zoho). If set incorrectly to Local, the server tries to deliver locally and the message is lost.
- Backup Mail Exchanger — Use only when this server is a secondary MX fallback.
- Automatically Detect Configuration — Checks DNS and sets mode dynamically. Can misfire if DNS propagation is incomplete.
Verifying Your MX Records
Before changing the routing mode, confirm where your MX records actually point:
dig MX yourdomain.com +short
If the output shows mail.yourdomain.com resolving to this server's IP, use Local Mail Exchanger. If it shows Google or Microsoft endpoints, use Remote Mail Exchanger.
You can also check from WHM shell:
host -t MX yourdomain.com
# or
nslookup -type=MX yourdomain.com 8.8.8.8
Step 2: Diagnose Email Forwarder Failures
Forwarders in cPanel work by having Exim relay a copy of the incoming message to a new destination. Since 2024, this breaks silently against Gmail, Outlook, and Yahoo because of how forwarding interacts with SPF and DMARC.
Why Forwarding Fails in 2026
When your server forwards a message from sender@external-domain.com to user@gmail.com, Gmail sees:
- From: sender@external-domain.com (unchanged)
- Sending server: your cPanel server's IP
- SPF check: FAIL — your server is not in external-domain.com's SPF record
- DMARC policy: If external-domain.com has
p=reject, Gmail drops the message entirely
The solution is SRS (Sender Rewriting Scheme), which rewrites the Return-Path so SPF passes, plus configuring ARC sealing.
Check Exim Mail Logs for Rejection Clues
# Live log tail
tail -f /var/log/exim_mainlog
# Search for a specific address
grep "user@yourdomain.com" /var/log/exim_mainlog | tail -50
# Find DMARC rejections
grep -i "dmarc" /var/log/exim_mainlog | tail -20
# Find SPF failures
grep -i "spf" /var/log/exim_mainlog | tail -20
Common rejection strings to watch for:
550 5.7.1 SPF check failed550 5.7.26 This mail is unauthenticatedDMARC policy of ... disallows spoofing550-5.7.1 Email rejected per DMARC policy
Step 3: Enable SRS for Forwarders in WHM
SRS (Sender Rewriting Scheme) is the industry-standard fix for SPF failures caused by forwarding. In WHM 110+, it is built in.
# Check current SRS setting in Exim config
grep -i "srs" /etc/exim.conf.local
To enable SRS via WHM:
- Log in to WHM as root
- Navigate to Service Configuration > Exim Configuration Manager
- Click the Advanced Editor tab
- Search for
srs - Set SRS Type to
forward(recommended) orreverse - Set a strong SRS Secret (random string, at least 32 characters)
- Click Save — Exim restarts automatically
After enabling SRS, forwarded messages will have a rewritten Return-Path like SRS0=hash=date=originaldomain=user@yourdomain.com. This passes SPF for your domain.
Step 4: Verify and Fix SPF, DKIM, and DMARC Records
Even with SRS enabled, your own domain's outgoing mail needs correct authentication records or recipients will reject it.
Check SPF Record
dig TXT yourdomain.com +short | grep spf
A correct cPanel server SPF record looks like:
v=spf1 +a +mx +ip4:YOUR.SERVER.IP ~all
If your server IP is missing or the record uses -all (hard fail) instead of ~all (soft fail), update it. In WHM, SPF records can be auto-generated via DNS Functions > Edit DNS Zone.
Verify DKIM Is Signing Outbound Mail
# Check if DKIM key exists for a domain
ls /etc/domainkeys/yourdomain.com/
# Test DKIM signing (send a test email and check headers)
echo "Test DKIM signing" | mail -s "DKIM Test" test@mail-tester.com
# Verify the DKIM DNS record
dig TXT default._domainkey.yourdomain.com +short
If DKIM is missing, regenerate it in cPanel: Email > Email Deliverability and click Repair next to DKIM.
Add a DMARC Record
If you do not have a DMARC record, add a DNS TXT record for _dmarc.yourdomain.com:
v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@yourdomain.com; pct=100; adkim=r; aspf=r
Start with p=quarantine rather than p=reject until you confirm all your legitimate sending sources pass authentication.
Step 5: Fix the Exim Mail Queue
After fixing authentication issues, stuck messages in the Exim queue need to be flushed or retried.
# View queue size
exim -bpc
# List queued messages
exim -bp | head -40
# Retry all deferred messages immediately
exim -qff
# Delete a specific message by ID
exim -Mrm MESSAGE_ID
# Flush all messages older than 7 days (bounced/undeliverable)
exiqgrep -o 604800 -i | xargs exim -Mrm
In WHM, you can also use Email > Mail Queue Manager for a GUI view of stuck messages.
Step 6: Fix Email Routing for Google Workspace / Microsoft 365
A very common mistake: the server is set to Local Mail Exchanger but the domain's MX records point to Google or Microsoft. All incoming mail gets delivered locally (and lost) instead of going to the external provider.
# WHM root shell: list email routing for all domains
whmapi1 listmaildomainstatus | python3 -c "import sys,json; d=json.load(sys.stdin); [print(r.get('domain','?'), r.get('status','?')) for r in d.get('data',{}).get('domains',[])]"
Fix via WHM API or cPanel GUI: change routing to Remote Mail Exchanger for any domain whose MX points externally.
You can also fix in bulk via WHM CLI:
# Set a domain to remote mail exchanger
whmapi1 setmaildomainstatus domain=yourdomain.com status=remote
Step 7: Configure Email Filters to Prevent Loops
Email forwarding loops occur when Domain A forwards to Domain B, which forwards back to Domain A, or when a forwarder points to an address on the same server that also has a forwarder.
# Check for routing loops
grep "too many hops" /var/log/exim_mainlog | tail -20
grep "loop detected" /var/log/exim_mainlog | tail -20
Exim's default hop limit is 25. If you see hop-limit errors, trace the forwarder chain:
# List all forwarders for a domain
cat /etc/valiases/yourdomain.com
Delete any circular forwarder entries and restart Exim:
service exim restart
# or
/scripts/restartsrv_exim
Step 8: Use the Email Deliverability Wizard
WHM 96+ includes an Email Deliverability tool that automatically diagnoses and repairs SPF, DKIM, and PTR records for all hosted domains. It is the fastest single fix for new servers or after an IP change.
- In WHM, navigate to Email > Email Deliverability
- Click Repair All to fix every domain at once, or repair domains individually
- Verify all checks show green: SPF ✓, DKIM ✓, PTR/rDNS ✓
# CLI equivalent — repair DKIM for all domains
/scripts/fixeverything
# or target one domain
/scripts/fixmailman yourdomain.com
Common Error Messages and Fixes
Error: "550 5.1.1 The email account that you tried to reach does not exist"
This means Exim accepted the message but the local mailbox does not exist. Check /etc/localdomains — if your domain is listed there but routing is set to Remote, remove the domain from localdomains:
grep yourdomain.com /etc/localdomains
# If present and routing should be remote:
sed -i '/yourdomain.com/d' /etc/localdomains
Error: "Deferred: Connection timed out" or Port 25 Blocked
Many cloud providers (AWS, GCP, Linode, Vultr) block outbound port 25 by default. Test with:
telnet gmail-smtp-in.l.google.com 25
If it hangs, request port 25 unblocking from your provider, or configure a smarthost relay in WHM: Service Configuration > Exim Configuration Manager > Routers > Send All Mail via a SmartHost.
Error: "550 Unauthenticated senders not allowed"
This is an outbound rejection from Gmail or Outlook. Your DMARC policy on the sender domain is too strict, or your DKIM key has rotated without updating DNS. Regenerate DKIM and verify the DNS TXT record matches the key in /etc/domainkeys/.
Post-Fix Verification Checklist
After applying fixes, validate end-to-end delivery:
- Send a test message to mail-tester.com — aim for 10/10
- Check MX Toolbox Blacklist (mxtoolbox.com) — your server IP should be clean
- Verify SPF alignment:
dig TXT yourdomain.com +short - Verify DKIM selector:
dig TXT default._domainkey.yourdomain.com +short - Test a forwarder by sending to the forwarded address and confirming delivery
- Check Exim queue is draining:
exim -bpcshould decrease over time
Conclusion
cPanel email routing and forwarder failures are almost always caused by a mismatch between routing mode and MX records, missing SRS configuration, or SPF/DKIM/DMARC misalignment. The good news is that WHM's built-in Email Deliverability wizard fixes most issues automatically — and enabling SRS in the Exim Configuration Manager handles forwarding authentication in minutes. If you want email routing configured correctly from day one — with SPF, DKIM, DMARC, and SRS all aligned — the team at CloudHouse server management handles cPanel/WHM email configuration as part of our standard server management service.
