Manually Clear from Console / Command Line cPanel Exim Mail Queue

Server Maintenance | Updated 2026

If the Exim mail queue on a cPanel server is backed up with stuck or spam messages, you can clear it from the command line. This guide is for server administrators with root access.

Server Admin Only

These commands require root SSH access

Shared hosting customers cannot clear the mail queue directly. If you believe emails are stuck in the queue on your account, open a support ticket and we will investigate.

01. View the Queue

# Count messages in queue
exim -bpc

# List all messages with sender, time, and size
exim -bp | head -50

# Find messages from a specific sender
exim -bp | grep "sender@domain.com"

02. Clear the Queue

# Delete ALL messages in the queue (nuclear option)
exim -bp | awk '/^ *[0-9]/{print $3}' | xargs exim -Mrm

# Delete frozen messages only
exim -bp | grep "frozen" | awk '{print $3}' | xargs exim -Mrm

# Delete messages from a specific sender
exim -bp | grep "spammer@domain.com" | awk '{print $3}' | xargs exim -Mrm

# Delete messages older than 24 hours
exiqgrep -o 86400 -i | xargs exim -Mrm

03. Force Delivery

# Force delivery attempt on all queued messages
exim -qff

# Force delivery of a specific message
exim -M <message-id>
Important

Before clearing the entire queue, check what is in it. A large queue often indicates a compromised account sending spam. Identify and fix the source before clearing, or the queue will fill right back up. Check exim -bp | awk '{print $4}' | sort | uniq -c | sort -rn | head -20 to find the top senders.

Shared Hosting Customer?

If your emails are delayed or not sending, open a ticket and we will check the queue for you.

Open a Support Ticket

Quick Recap

  1. View queue: exim -bp
  2. Count messages: exim -bpc
  3. Delete frozen: Filter by "frozen" and pipe to exim -Mrm
  4. Find the source before clearing - Check top senders
  5. Shared hosting users: Open a ticket instead

Server administration · Last updated March 2026 · Browse all Server Maintenance articles

  • 147 Users Found This Useful

Was this answer helpful?

Related Articles

VPS Time Not Correct with Time Server

Server Maintenance | Updated March 2026 When a VPS or dedicated server's system clock drifts...

Killing cPanel Backups via Command Line / Shell

Server Maintenance | Updated 2026 When a cPanel backup process hangs or runs too long, it can...

Repairing and Optimizing all MySQL and MariaDB Databases on the Server

Server Maintenance | Updated 2026 Regularly repairing and optimizing MySQL/MariaDB tables...

ModSecurity: collection_store: Failed to access DBM file /var/cpanel/secdatadir/ip: Permission denied

Server Maintenance | Updated 2026 The error collection_store: Failed to access DBM file...

Remount /tmp with exec permission

Server Maintenance | Updated 2026 Some software installations and compilation tasks require...



Save 30% on web hosting - Use coupon code Hosting30