Radoslav Panev

SysAdmin and DevOps

How to work with exim in console

19 Oct 2014 » FreeBSD, Linux

Hello, I will show basic commands for working with exim in console 🙂

Log file is located in /var/log/exim_mainlog

Email information when sending and receiving :

Real time tracking entries exim_mainlog:

 tailf /var/log/exim_mainlog

Look at the last 500 entries in exim_mainlog:

tail -500 /var/log/exim_mainlog

To delete messages in queue older than 5 days (sometimes stand there and do not want to go). The figure comes from (86,400 seconds is one day * 5 days = 432,000 seconds):

exiqgrep -o 432000 -i | xargs exim -Mrm

To view the headers of the message, sometimes it is useful if you need more information about any sent, received or not sent, not received message:

exim -Mvh

To view the contents of the letter:

exim -Mvb

To view the logs for the letter:

exim -Mvl

Everyone goes to delete mails in the queue that have the following string in your content: STRING:

grep -lr 'STRING' /var/spool/exim/input/ | sed -e 's/^.*\/\([a-zA-Z0-9-]*\)-[DH]$/\1/g' | xargs exim -Mrm

To delete many emails sent from: root@panevinfo.eu. Working with logs (exim_mainlog for received and sent » / var / log / maillog for me and Razlog pop3, imap):

xiqgrep -i -f '' | xargs exim -Mrm

To check for sending a letter from a certain IP:

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

To check for mails sent to a specific IP address:

exigrep '=> .* \[127.0.0.1\]' /path/to/exim_log

How to see all the emails that were returned in response to already sent mail:

exigrep '=> .*email@email.com' /var/log/exim_mainlog | fgrep '<='

To see the letters sent and received by email@email.com:

tail -5000 /var/log/exim_mainlog| grep "email@email.com"

To see the letters sent by email@email.com:

tail -5000 /var/log/exim_mainlog| grep "email@email.com" | grep "<="

To see the letters received from email@emaila.com:

tail -5000 /var/log/exim_mainlog| grep "email@email.com" | grep "=>"

You can check how a message is delivered:

exim -bt email@email.com

for more information : exim