Useful Exim Commands with examples

In UNIX system, the message transfer agent used (MTA) is Exim. Under the terms of GNU General Public License, the Exim is freely available. Exim is used for locating the spam activity on the servers. Using the Exim command, we can route the mail and facilities for checking incoming mail. Configuration of Exim is little bit different.

Usage of Exim command is very easy to manage. It is easy to identify the users who send bulk emails and also mail queues.

 

1) To get message count in the queue:

exim -bpc

2) List the messages in the queue:

exim -bop

3) Summary of messages in the queue (count, volume, oldest, newest, domain, and totals):

exim -bp | exiqsumm

4) Display what Exim is doing right now:

exiwhat

5) Display all Exim configuration settings:

exim -bP

 

Exiqgrep Commands

Exiqgrep is a grepping tool used for searching the patterns from the mail queue. The exiqgrep help to avoid the complex combinations of flags and various sorting and pattern matching commands such as exim –bp, cut, awk, grep, and wc-l.

6) Search the queue for messages from a specific sender:

exiqgrep -f [luser]@domain

7) Search the queue for messages for a specific recipient/domain:

exiqgrep -r [luser]@domain

8) Print messages older than the specified number of seconds:

exiqgrep -o 74000

9) Print messages that are younger than the specified number of seconds:

exiqgrep -y 3600 […]

10)  Print just the message-id as a result of one of the above two searches:

exiqgrep -i [ -r | -f ] …

11) Print a count of messages matching one of the above searches:

exigrep  -c

 

Queue Management

12) Start a queue run:

exim -q -v

13) Remove a message from the queue:

exim -Mrm <message-id> [ <message-id> … ]

14) Freeze message:

exim -Mf <message-id> [ <message-id> … ]

15) Throw a message:

exim -Mt <message-id> [ <message-id> … ]

16) Force delivery message:

exim -M <message-id> [ <message-id> … ]

17) Deliver a message, if and only if retry time reached:

exim -Mc <message-id> [ <message-id> … ]

18) Force message to fail and bounce as “cancelled by administrator”:

exim -Mg <message-id> [ <message-id> … ]

19) Remove all frozen message:

exiqgrep -z -i | xargs exim –Mrm

20) Remove all messages older than number of days:

exiqgrep -o 432000 -i | xargs exim –Mrm

21) Freeze all queued mail form a particular sender:

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

22) Print message’s header:

exim -Mvh <message-id>

23) Print message’s body:

exim -Mvl <message-id>

24) Add a recipient to a message:

exim -Mar <message-id> <address> [<address> …]

25) Edit the sender of a message:

exim -Mes <message-id> <address>

 

If you need any further assistance please reach our support department.