Examples of commands for working with the exim mail server

Examples of commands for working with the exim mail server

With Exim installed, you can work with messages via the command line. Let's look at several commands that you'll need when working:

Display messages in the queue:
exim -bpr

Similar command:
mailq

View the number of messages that are in the queue:

exim -bpc

Force start sending messages from the queue:

exim -q -v


If you need to clear the queue, run the command:

exipick -i | xargs exim -Mrm


If you need to delete messages that are marked as "frozen", run the following command:

exipick -zi | xargs exim -Mrm


View the number of messages that are marked as "frozen":

exim -bpr | grep frozen | wc –l


If you need to delete all messages from a specific sender, run:

exiqgrep -i -f [email protected] | xargs exim -Mrm


Where, [email protected] is the mail account of the desired sender.

We can also perform actions with messages.


Display the message body:

exim -Mvb ID_MESSAGE


Display the headers of a specific message:

exim -Mvb ID_MESSAGE


Delete a specific message:

exim -Mrm ID_MESSAGE


View active senders:

exim -bp | awk '{print $4}' | sort | uniq -c | sort -rn


Exim logs are stored in /var/log/exim/mail.log or /usr/log/exim_mainlog
Thus, you can see the reasons for slow delivery of letters or the creation of a queue or where letters are sent from.


See if spam is coming from the /home/admin/public_html directory:

tail -f /var/log/exim_mainlog | grep /home/admin/public_html


Find messages that were sent from a specific IP address:

exigrep '<= .* [123.123.123.123] ' /var/log/exim_mainlog

Where, 123.123.123.123 is the desired IP address.

Find the reason for rejecting a message for a specific mailbox:

grep [email protected] /var/log/exim_mainlog