-3

Question Exim4 - DEBIAN :

How to automate deletion of messages in the queue (selected by a keyword present in the corp email message) ?

Thanks a lot.

2

1 Answer 1

1

First and foremost, if your system is generating messages that are ending up in your queue because they are to email addresses that are not deliverable, it's FAR better to detect it during injection instead of only after attempting to deliver the email. Big email providers negatively colour your sending reputation if you are sending to too many invalid email addresses. With that warning, I am continuing and assuming you have done everything you can to evaluate valid/invalid recipient out before it gets into the queue.

I would probably write a shell or perl script that will do something like this process:

  1. Generate list of messages older than 2 hours (pick some time that works for you).
  2. For each message, pipe the message body to grep to see if it matches your regex.
  3. Delete the message if it does.

Basic commands for each step, may need massaging:

  1. exiqgrep -z -i -o 720
  2. exim -Mvb $id | grep -q -E 'your_search_regex'
  3. exim -Mrm $id

Not the answer you're looking for? Browse other questions tagged .