cPanel/WHM Exim Mail Queue Full? Complete Fix Guide (2026)

Priya

Content Writer & Researcher

Last Updated: 28 October 2026
cPanel/WHM Exim Mail Queue Full? Complete Fix Guide (2026)
🖥️

Is Your cPanel Server Drowning in a Backed-Up Mail Queue?

CloudHouse Technologies manages Exim queue crises, spam injection cleanups, and email deliverability for shared hosting servers around the clock. Get your mail flowing again within the hour.

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

Your cPanel server's Exim mail queue fills up, and suddenly nobody's email is going out. Thousands of deferred messages pile up, your server's IP reputation takes a hit, and your clients start calling. This guide walks you through diagnosing the root cause, safely clearing the queue, and hardening Exim to prevent it from happening again.

Step 1: Check the Current Queue Size

Before touching anything, quantify the problem. Log in to your server via SSH as root and run:

exim -bpc

This returns a single number — the total messages currently sitting in the queue. A healthy server running a modest shared hosting environment typically stays under 100. Anything over 1,000 needs immediate attention.

For a full breakdown with sender, recipient, and age of each message:

exim -bp | head -100

You can also check via WHM: go to Email > Mail Queue Manager to view, search, and delete messages from a GUI.

💡 None of these worked? Skip the guesswork.

Get Expert Help →

Step 2: Identify the Account Flooding the Queue

A bloated queue almost always traces back to one compromised account or script sending bulk mail. Find it before you clear anything, or the queue will fill right back up.

1Find top senders by message count:
exim -bp | awk '{print $4}' | sort | uniq -c | sort -rn | head -20
2Find the script or PHP file responsible:
grep "cwd=" /var/log/exim_mainlog | awk -F'cwd=' '{print $2}' | awk '{print $1}' | sort | uniq -c | sort -rn | head -20

The cwd= field shows the working directory of the process that injected the mail — this almost always points directly to the compromised WordPress plugin, contact form, or PHP script.

3Suspend the account immediately in WHM under Account Functions > Modify an Account until you've cleaned the malware.

Step 3: Remove Frozen Messages

Frozen messages are emails Exim has given up on after repeated delivery failures. They sit in the queue consuming disk space and memory but never delivering. Remove them first.

1. Count frozen messages:

exim -bp | grep frozen | wc -l
2Delete all frozen messages:
exim -bp | grep frozen | awk {'print $3'} | xargs exim -Mrm

Or use the faster one-liner that handles large queues without hitting shell argument limits:

exiqgrep -z -i | xargs exim -Mrm
1Enable Max Defer settings in WHM: Go to WHM > Exim Configuration Manager > Basic Editor. Set Max Defers Per Hour to a reasonable limit (e.g., 500) and enable Max Defers Per Hour Percentage to auto-suspend accounts that exceed it.

2. Enable BoxTrapper and SpamAssassin globally for all accounts under WHM > Email > Exim Configuration Manager.

3. Set up email authentication records: Use WHM's Email Deliverability tool to verify SPF, DKIM, and DMARC are correctly configured for every domain. Missing or broken records cause remote servers to bounce mail back into the queue.

4. Schedule regular queue monitoring:

# Add to root's crontab — alerts if queue exceeds 500
*/15 * * * * count=$(exim -bpc); if [ "$count" -gt 500 ]; then echo "Exim queue at $count" | mail -s "ALERT: Exim queue spike" admin@yourdomain.com; fi

5. Install CSF/LFD (ConfigServer Security & Firewall) — it includes email-specific rate limiting that auto-suspends accounts blasting outbound mail beyond configurable thresholds.

Step 8: Verify Exim Service Health After Cleanup

# Check Exim is running
systemctl status exim

# Restart Exim if needed
systemctl restart exim

# Check Exim logs for errors
tail -f /var/log/exim_mainlog

After a cleanup, watch the mainlog for a few minutes to confirm legitimate mail is flowing and no new spam injection is occurring. If the queue spikes again within hours, the compromised script is still active — revisit Step 2 and audit the account's file modification timestamps:

find /home/username/public_html -mtime -7 -name "*.php" | head -30

WHM GUI Alternative

If you prefer not to use the command line, WHM provides a Mail Queue Manager at Email > Mail Queue Manager. You can search by sender, recipient, or message ID, and delete individual messages or batches. However, the GUI is impractical when the queue holds tens of thousands of messages — SSH commands are orders of magnitude faster at that scale.

FAQs

Related service: Server Management Service - Managed Linux and Windows servers: monitoring, patching, security and 24/7 support.

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

The queue is being replenished faster than Exim can clear it. This almost always means a compromised PHP script or WordPress plugin is still injecting mail. Check the Exim mainlog's cwd= field and find/remove the malicious script before clearing the queue again. Suspending the affected cPanel account temporarily stops the flood immediately.

Need this done for you?

Server Management Service

Managed Linux and Windows servers: monitoring, patching, security and 24/7 support.

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...