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 "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>
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 TicketQuick 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 March 2026 · Browse all Server Maintenance articles
