Useful Exim Commands for Dedicated & VPS Linux Servers
Applies to: Dedicated server and VPS customers with root SSH access.
Exim is the default mail transfer agent (MTA) used on cPanel/WHM servers. These commands help you manage the mail queue, diagnose mail issues, and monitor mail activity directly from SSH.
Queue overview & monitoring
Count the number of messages in the queue
exim -bpc
List all messages in the queue (ID, size, sender, recipient, time)
exim -bp
Print a summary of the queue (counts, volume, domains)
exim -bp | exiqsumm
Check what Exim is doing right now
exiwhat
Routing & configuration
Test how Exim will route a specific address
exim -bt user@domain.com
Display Exim configuration parameters
exim -bP
Searching the mail queue
Find messages from a specific sender
exiqgrep -f user@domain.com
Find messages to a specific recipient or domain
exiqgrep -r user@domain.com
Find messages older than X seconds (example: older than 1 hour)
exiqgrep -o 3600
Find messages newer than X seconds
exiqgrep -y 3600
Match messages by size using a regex (example: 500–599 bytes)
exiqgrep -s '^5..$'
Match only frozen messages
exiqgrep -z
Match only unfrozen (non-frozen) messages
exiqgrep -x
Print only message IDs from the queue
exiqgrep -i
Queue management & message control
Start a full queue run
exim -q -v
Start a queue run for local deliveries only
exim -ql -v
Remove a message from the queue
exim -Mrm <message-id>
Freeze a message
exim -Mf <message-id>
Thaw (unfreeze) a message
exim -Mt <message-id>
Force delivery of a message regardless of retry time or frozen state
exim -M <message-id>
Deliver a message only if its retry time has been reached
exim -Mc <message-id>
Force a message to fail and bounce as "cancelled by administrator"
exim -Mg <message-id>
Bulk message operations
Remove all frozen messages
exiqgrep -z -i | xargs exim -Mrm
Remove all messages older than five days
(5 days × 24 hours × 3600 seconds = 432000 seconds)
exiqgrep -o 432000 -i | xargs exim -Mrm
Freeze all queued mail from a given sender
exiqgrep -f user@example.com -i | xargs exim -Mf
Viewing message content
View a message's headers
exim -Mvh <message-id>
View a message's body
exim -Mvb <message-id>
View a message's logs
exim -Mvl <message-id>
Editing queued messages
Add a recipient to a message
exim -Mar <message-id>
Edit the sender of a message
exim -Mes <message-id>
Admin notes & best practices
- Never clear a large mail queue without first investigating possible spam or compromised accounts.
- Use WHM's “Mail Queue Manager” for a graphical overview and then SSH for advanced control.
- Exim logs are usually located at:
/var/log/exim_mainlog /var/log/exim_rejectlog /var/log/exim_paniclog - If the mail queue grows rapidly, check for hacked CMS installs, compromised passwords, or vulnerable scripts.