16 July 2014
Comments: Comments Off on Exim command line

Exim command line

Exim is a powerful MTA. Exim is highly configurable, and therefore has features that are lacking in other MTAs. It has always had substantial facilities for mail policy controls, providing facilities for the administrator to control who may send or relay mail through the system. Exim  also comes with powerful utilities to manage mail queue via command line.

Exim mail queue information commands

Current count of emails in mailqueue

# exim -bpc

List all emails in mail queue

# exim -bp

Generate a summary table for all messages in the queue

# exim -bp | exiqsumm

Other exim commands

Display Exim stats using the default log file

# eximstats /path/to/exim_mainlog

Same display as above but more concise

# eximstats -ne -nr -nt /path/to/exim_mainlog

Narrow down Exim stats generation to a particular day

# fgrep YYYY-MM-DD /path/to/exim_mainlog | eximstats

Show what Exim is doing at the moment

# exiwhat

Test how Exim’s configuration will handle mail sent to the specified address

# exim -bt [user]@domain

Display Exims current configuration settings

# exim -bP

Exim commands to search mail queue

Find all messages to a particular address in mailqueue

# exiqgrep -r [user]@domain

Only print the message ID

# exiqgrep -i [ -r | -f ] user@domain.com

Count the number of matches based on a recipient/sender search

# exiqgrep -c [ -r | -f ] user@domain.com

Managing the queue

Start a full queue run

# exim -q -v

Start a queue run only for local messages

# exim -ql -v

Remove a specific message(s) from the queue

# exim -Mrm  MESSAGE_ID

Freeze a message so no delivery attempts will be made

# exim -Mf MESSAGE_ID

Thaw a message so that Exim will retry delivery again

# exim -Mt MESSAGE_ID

Force-deliver a specific message

# exim -M  MESSAGE_ID

Force a specific message to bounce

# exim -Mg  MESSAGE_ID

Deliver a message only if the retry time has been reached

# exim -Mc  MESSAGE_ID

Delete all frozen messages in the queue

# exiqgrep -z -i | xargs exim -Mrm

Remove all messages older than 24 hours

# exiqgrep -i -o 86400 | xargs exim -Mrm

Freeze all mail in the queue from a specific sender

# exiqgrep -i -f luser@example.tld | xargs exim -Mf

View a specific messages full headers

# exim -Mvh MESSAGE_ID

View a specific messages body

# exim -Mvb MESSAGE_ID

View a specific messages Exim log

# exim -Mvl MESSAGE_ID

Comments are closed.