Delete Mails from exim queue for a particular content

prashantbhushan

Verified User
Joined
Jul 21, 2006
Messages
199
Location
Pune, India.
Hi All,
My exim queue is full of junk mails containing the "common word". I want to delete all the mails from the queue containing this particular word. How can i do that ?
I know mails from exim queue can be deleted using "message id". (have to delete all spam mails one by one)
How to delete all mails from the queue containing particular word at once ?
 
what you want do is not compatible with RFC
=> you accept mail or reject it, BUT you can't delete

Reject at smtp time if you want.
 
prashantbhushan said:
Hi All,
How to delete all mails from the queue containing particular word at once ?

You can use simple shell script.

The format of exim queue:

root@cobra/: exim -bp
9h 106K 1GkxAA-000KL4-Lm <some_sender>
[email protected]

In this case "<some_sender>" is particular word.

To grep message id from the queue containing this particular word:
exim -bp | grep '<some_sender>' | awk '{ print $3}'

To view the message log for message id (for every message with particular address):
exim -bp | grep '<some_sender>' | awk '{ print $3; system("exim -Mvl "$3)}'

To remove message id from the queue (for every message with particular address):
exim -bp | grep '<some_sender>' | awk '{ print $3; system("exim -Mrm "$3)}'
 
xemaps said:
what you want do is not compatible with RFC
=> you accept mail or reject it, BUT you can't delete
While RFCs may not allow you to delete mail awaiting delivery in your mailqueue, it's certainly your right (and perhaps your responsibility) to delete mail that will otherwise be spam, or perhaps will just clog your queue until it times out and the system deletes it.

So I'd say go ahead and delete it if you want to.

Jeff
 
Back
Top