Linux – Using Exim to remove e-mails from one sender

emaileximlinux

2012-11-15 09:24:03 1TZ0MN-0000Tm-2W <= USER@HOST.DOMAIN.TLD U=USER P=local S=439 T="http://USER-DOMAIN.net" for SENTTO@yahoo.com
2012-11-15 09:24:09 1TZ0MS-0000UH-Jq <= USER@HOST.DOMAIN.TLD U=USER P=local S=439 T="http://USER-DOMAIN.net" for SENTTO@yahoo.com
2012-11-15 09:24:13 1TZ0MX-0000Us-Me <= USER@HOST.DOMAIN.TLD U=USER P=local S=439 T="http://USER-DOMAIN.net" for SENTTO@yahoo.com
2012-11-15 09:24:20 1TZ0Md-0000VI-Rh <= USER@HOST.DOMAIN.TLD U=USER P=local S=439 T="http://USER-DOMAIN.net" for SENTTO@yahoo.com
2012-11-15 09:24:24 1TZ0Mi-0000Vf-KQ <= USER@HOST.DOMAIN.TLD U=USER P=local S=439 T="http://USER-DOMAIN.net" for SENTTO@yahoo.com
2012-11-15 09:24:30 1TZ0Mn-0000W6-TR <= USER@HOST.DOMAIN.TLD U=USER P=local S=439 T="http://USER-DOMAIN.net" for SENTTO@yahoo.com
2012-11-15 09:24:36 1TZ0Mt-0000WY-SR <= USER@HOST.DOMAIN.TLD U=USER P=local S=439 T="http://USER-DOMAIN.net" for SENTTO@yahoo.com
2012-11-15 09:24:41 1TZ0Mz-0000XI-1S <= USER@HOST.DOMAIN.TLD U=USER P=local S=439 T="http://USER-DOMAIN.net" for SENTTO@yahoo.com
2012-11-15 09:24:45 1TZ0N3-0000Xi-Mz <= USER@HOST.DOMAIN.TLD U=USER P=local S=439 T="http://USER-DOMAIN.net" for SENTTO@yahoo.com
2012-11-15 09:24:51 1TZ0N9-0000YI-FX <= USER@HOST.DOMAIN.TLD U=USER P=local S=439 T="http://USER-DOMAIN.net" for SENTTO@yahoo.com

Is there a way to go in and drop all their e-mails? They have 1000s in there.

I tried:

exiqgrep -ir SENTTO@yahoo.com | xargs exim -Mrm
exim: no message ids given after -Mrm option

Best Answer

For me below worked perfect:

To delete all emails from any sender in exim queue use:

exiqgrep -i -f email@email.com | xargs exim -Mrm

To delete all emails to any receiver in exim queue use:

exiqgrep -i -r email@email.com | xargs exim -Mrm

Below are exiqgrep and exim commands help:

exiqgrep -h Exim message queue display utility. -h This help message. Selection criteria:

-f <regexp> Match sender address sender (field is "< >" wrapped)
-r <regexp> Match recipient address
-s <regexp> Match against the size field from long output
-y <seconds>    Message younger than
-o <seconds>    Message older than
-z      Frozen messages only (exclude non-frozen)
-x      Non-frozen messages only (exclude frozen)

Display options: -c Display match count -l Long Format [Default] -i Message IDs only -b Brief Format -R Reverse order

EXIM Command:

 exim -bp - shows messages in queue
exim -bpc - shows the no.of messages in queue
exim -bP - shows the current configurations of exim
exim -bV - shows the version and configuration file of exim
exiwhat - Finding out what Exim processes are doing
exim -qf - Force another queue run
exim -qff - Force another queue run and attempt to flush frozen messages
exim -Mvl - messageID View Log for message
exim -Mvb - messageID View Body for message
exim -Mvh - messageID View Header for message
exim -Mrm - messageID Remove message (no errors sent)
exim -Mg - messageID Give up and fail message, message bounces to sender
exiqgrep -zi
-z : frozen mails only
-i : display message IDs only
exim -M emailID - Force delivery of one message