Exim is a message transfer agent (MTA) developed at the University of Cambridge for use on Unix/Linux systems connected to the Internet. It is freely available under the terms of the GNU General Public Licence.
Exim is used for locating the spam activity on the servers. There is a great deal of flexibility in the way mail can be routed, and there are extensive facilities for checking incoming mail. Exim can be installed in place of Sendmail, although the configuration of Exim is quite 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. Here is an Exim Cheatsheet of useful Exim commands
1) To get message count in the queue:
exim -bpc
2) List the messages in the queue:
exim -bp
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
6) Test how Exim Server will route a given address:
exim -bt [email protected]
7) 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.1.1
Searching Queue with Exiqgrep Commands
Exim includes a utility called Exiqgrep, this 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.
1) Search the queue for messages from a specific sender:
exiqgrep -f [luser]@domain
2) Search the queue for messages for a specific recipient/domain:
exiqgrep -r [luser]@domain
3) Print just the message-id as a result of one of the above two searches:
exiqgrep -i [ -r | -f ] […]
4) Print the message-ids of entire queue:
exiqgrep -i
5) Print messages older than the specified number of seconds:
exiqgrep -o 7200
6) Print messages that are younger than the specified number of seconds:
exiqgrep -y 3600
7) Print a count of messages matching one of the above searches:
exigrep -c
8) Use -s to match the size of a message with a regex. For example, 800-899 bytes:
exiqgrep -s ‘^8..$’ […]
Queue Management
1) Start a queue run:
exim -q -v
2) Remove a message from the queue:
exim -Mrm <message-id> [ <message-id> … ]
3) Freeze message:
exim -Mf <message-id> [ <message-id> … ]
4) Throw a message:
exim -Mt <message-id> [ <message-id> … ]
5) Force delivery message:
exim -M <message-id> [ <message-id> … ]
6) Deliver a message, if and only if retry time reached:
exim -Mc <message-id> [ <message-id> … ]
7) Force message to fail and bounce as “cancelled by administrator”:
exim -Mg <message-id> [ <message-id> … ]
8) Remove all frozen message:
exiqgrep -z -i | xargs exim –Mrm
9) Remove all messages older than number of days:
exiqgrep -o 432000 -i | xargs exim –Mrm
10) Freeze all queued mail form a particular sender:
exiqgrep -i -f [email protected] | xargs exim –Mf
11) Print message’s header:
exim -Mvh <message-id>
12) Print message’s body:
exim -Mvl <message-id>
13) Add a recipient to a message:
exim -Mar <message-id> <address> [<address> …]
14) Edit the sender of a message:
exim -Mes <message-id> <address>
If you need any further assistance please reach our support department or comment under this article.