Exim queue management

MailCleaner Support
Added about 2 years ago

State: Draft

The short way: It is simply Exim MTA queue management with some specificities

all binary for exim are in /opt/exim4/bin/ so all command should be that form:
/opt/exim4/bin/exim -Mvh OneMailID
This command just above allow to see header of the mail ID, replace with -Mvb for body or -Mvl for logs

But this will not "work" like this.
You ll have to specify on what instance of exim you want to work: exim_stage1 = incoming, exim_stage2 = filtering, exim_stage4 = outgoing. Simple, don't ask for stage 3 !

So to see all message in the exim incoming queue: /opt/exim4/bin/exiqgrep -C /usr/mailcleaner/etc/exim/exim_stage1.conf
you can specify recipient or sender with respectively -r or -f like this:
/opt/exim4/bin/exiqgrep -C /usr/mailcleaner/etc/exim/exim_stage1.conf -r "@domain.tld"
Care this is regexp so blackslashing the dot is needed here
Last but not least you can add a modifier to this line, i use -c to count messages, -i to get their ID
it gives:
/opt/exim4/bin/exiqgrep -C /usr/mailcleaner/etc/exim/exim_stage1.conf -c -r "@domain.tld"
or /opt/exim4/bin/exiqgrep -C /usr/mailcleaner/etc/exim/exim_stage1.conf -i -r "@domain.tld"

A general command which allow you to get information fast is exiqsumm. you need to pass him messages from queue so:
/opt/exim4/bin/exiqgrep -C /usr/mailcleaner/etc/exim/exim_stage1.conf | /opt/exim4/bin/exiqsumm

To delete some message you ll use exiqgrep -i to get IDs and exim -Mrm to delete (with xargs because shell are limiting size of arguments so this won't work correctly without)
/opt/exim4/bin/exiqgrep -C /usr/mailcleaner/etc/exim/exim_stage1.conf -i -r "@domain.tld" | xargs /opt/exim4/bin/exim -C /usr/mailcleaner/etc/exim/exim_stage1.conf -Mrm
With this command just below, be sure to add -r or -f, because if you forget, you ll delete all messages ID here... from this queue.

Finally, don't forget to replace the "stage1" part with the stage you re interested by, and of course, log on both nodes of your cluster to repeat command if needed.

You can read some documentations on the web, one is easy to find and complete enough: http://bradthemad.org/tech/notes/exim_cheatsheet.php

And that's all, with a bit of training you ll become a exim queue pro manager !