how to mass delete after a hacked mail?

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


voytek at sbt.net.au 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 emu.sbt.net.au>")
> 

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)
http://www.dns24.ch/ - free dynamic DNS, made in Switzerland.



More information about the dovecot mailing list