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.
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 "[email protected]"
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 "[email protected]" | 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>
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 TicketFrequently Asked Questions
How do I view the Exim mail queue?
As root run exim -bp to list queued messages, or exim -bpc to show just the count. This reveals stuck or backlogged mail. It applies to VPS and dedicated servers with root; shared customers do not manage the Exim queue.
How do I clear the Exim mail queue?
As root, exiqgrep lets you target spam by sender before removing it, or you can remove messages by ID with exim -Mrm. Clearing the entire queue also deletes legitimate mail, so target spam where possible rather than wiping everything.
How do I force delivery of the queued mail?
Run exim -qff as root to force a delivery attempt on the whole queue, including frozen messages. This flushes legitimate mail that was merely delayed instead of deleting it, so try it before any mass removal.
Do shared hosting customers manage the Exim queue?
No. The mail queue is server-level and managed by us on shared hosting. This guide is for VPS and dedicated administrators with root. If outbound mail seems stuck on a shared account, open a ticket.
Quick Recap
- View queue:
exim -bp - Count messages:
exim -bpc - Delete frozen: Filter by "frozen" and pipe to
exim -Mrm - Find the source before clearing - Check top senders
- Shared hosting users: Open a ticket instead
Server administration · Last updated November 2026 · Browse all Server Maintenance articles
