Exim Cheatsheet

Exim is the widely used open source mail transfer agent. It is responsible for routing, delivering, and receiving email messages. Here are some of my favorite, useful exim commands via shell.

This command will show exim processes including the path to the script being utilized to send mail. Very useful in locating a spamming script:

ps -C exim -fH eww

This will show the route of the email address. It is useful when you try to diagnose email delivery problems:

exim -bt user@domain.com

To perform a SMTP testing session as if the mail comes from a particular host for testing filtering rules inside your server:

exim -bh ipaddresshere

This will show what exim is currently doing:


Mail server queue:

exim -bpc   // print the total number of emails currently in server queue.
exim -bp   // print mails in queue sorting by time, size,...
exim -bp | exiqsumm   // count, volume, oldest, newest, domain, and totals

To list exim’s configuration setting:

exim -bP

To start a queue run:

exim -q -v

To start a queue run for just local deliveries:

 exim -ql -v

To remove a message from the queue:

exim -Mrm <message-id>

To freeze a message:

exim -Mf <message-id>

To force delivery of a message:

exim -M <message-id>

To remove all frozen messages:

exiqgrep -z -i | xargs exim -Mrm

To remove all messages older than 1 day (the number is in seconds):

exiqgrep -o 86400 -i | xargs exim -Mrm

To freeze all queued mail from a given sender:

exiqgrep -i -f user@domain.com | xargs exim -Mf

Message viewing:

exim -Mvh <message-id>    // view message's headers
exim -Mvb <message-id>    // view message's body
exim -Mvl <message-id>    // view message's logs


At times, we will be required to search the mail queue for a particular message to help troubleshooting mail problems for our users. Here are some useful exiqgrep commands.

This will search the queue for messages coming from a specific sender:

exiqgrep -f user@domain.com

This will search the queue for messages from a specific recipient:

exiqgrep -r user@domain.com

This will display messages older than the specified number of seconds.

exiqgrep -o 86400    // more than a day old

This will display messages newer than the specified number of seconds.

exiqgrep -y 3600    // less than an hour old

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s