Exim Commands

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) on cPanel/WHM systems. The commands below let administrators inspect and manage the mail queue, diagnose delivery issues, and view message content directly from SSH. Use caution when removing or modifying queued mail — always investigate root causes first.


Queue overview & monitoring

Count 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 × 3600 = 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

  • Investigate root causes before mass‑removing queued mail — look for spam scripts, compromised accounts, or open relays.
  • Use WHM's Mail Queue Manager for a graphical overview, then SSH for precise control.
  • Exim log locations:
    /var/log/exim_mainlog
    /var/log/exim_rejectlog
    /var/log/exim_paniclog
  • When using xargs with queue operations, test the command first by printing IDs (e.g., exiqgrep -i) to avoid accidental deletions.
  • Consider temporarily freezing the queue (exim -bpc to inspect, then exiqgrep -i | xargs exim -Mf) while you investigate high volume issues.

Mail System Management

Fast2Host provides managed support for Exim and mail queue issues — contact support if you suspect a compromise or need assistance.

Contact Support →
Was this article helpful?

mood_bad Dislike 0
mood Like 1
visibility Views: 15334

Need more information or have a question ?