how to mass delete after a hacked mail?

Per Jessen per at
Sat Sep 17 08:15:00 UTC 2016

voytek at wrote:

> I had a hacked user account resulting in several thousand bounces back
> to that email inbox, account now corrected, but, how can I mass delete
> bounces with say subject like:
> "Undelivered Mail Returned to Sender"
> (by from ? ""Mail Delivery System" <MAILER-DAEMON at>")

How about this - 

find <maildir>/cur  -type f -ctime -7 | xargs
grep -l '^Subject:.*Undelivered Mail Returned to Sender' | xargs rm

(the -7 will limit the search to files created in the last week). 

Obviously run some tests first _without_ "xargs rm".

Per Jessen, Zürich (15.8°C) - free dynamic DNS, made in Switzerland.

More information about the dovecot mailing list