Exim Command Cheat Sheet

February 13, 2015

Image for Exim Command Cheat Sheet from unsplash.com

I've had this Exim command cheat sheet in Evernote for a while and thought it would prove useful to others.

Show the mail in queue for $name:

exim -bp|grep $name

View message header:

exim -Mvh $MSGID

View message body:

exim -Mvb $MSGID

Force delivery of message:

exim -M $MSGID

View the transact of message:

exim -v -M $MSGID

Force delivery of one message:

exim -M email-id

Force another queue run:

exim -qf

Force another queue run and attempt to flush the frozen message:

exim -qff

View the log for the message:

exim -Mvl messageID

View the body of the message:

exim -Mvb messageID

View the header of the message:

exim -Mvh messageID

Remove message without sending any error message:

exim -Mrm messageID

Giveup and fail message to bounce the message to the Sender:

exim -Mg messageID

How much mail in the queue:

exim -bpr | grep "<" | wc -l

How many Frozen mails in the queue:

exim -bpr | grep frozen | wc -l

Deleting Frozen Messages:

exim -bpr | grep frozen | awk {'print $3'} | xargs exim -Mrm

To find out, how many messages are there in the mail queue:

exim -bpc

To check the mails in the queue:

exim -bp

Print a summary of messages in the queue (count, volume, oldest, newest, domain, and totals):

exim -bp | exiqsumm

Print what Exim is doing right now:

exiwhat

Test how exim will route a given address:

[email protected]# exim -bt [email protected] [email protected]
 <-- [email protected]
router = localuser, transport = local_delivery
[email protected]# exim -bt [email protected] [email protected]
router = localuser, transport = local_delivery
[email protected]# exim -bt [email protected]
router = lookuphost, transport = remote_smtp
host mail.remotehost.com [1.2.3.4] MX=0

Run a pretend SMTP transaction from the command line

As if it were coming from the given IP address. This will display Exim's checks, ACLs, and filters as they are applied. The message will NOT actually be delivered:

exim -bh 192.168.11.22

Test SMTP

You will need to install the swaks program to do this.

swaks --tls --server your.mailhost.com --to [email protected] --from [email protected]
--auth PLAIN --auth-user myauthuser --header-X-Test "test email"

swaks --tls --server your.mailhost.com --from [email protected] --auth PLAIN
--auth-user myauthuser --header-X-Test "test email" --auth-password p455w0rd 
--to [email protected]