My mail queue has grown to over 70000 emails. Is there any way I can do a filtered delete to get rid of outgoing emails from the MAILER-DAEMON@ without losing any potentially valuable emails?
migrated from stackoverflow.com Sep 7 '09 at 20:05
you didn't mention which email server you use, assuming you use postfix
grep MAILER-DAEMON q.txt | sed 's/ .*//' | sed 's/^/postsuper -h /' > md.sh
if you want you can put everthing into one line, but if you have a lot of mails in your queue, this will take some time and putting the list into a file first saves you running the command again if something goes wrong.
with postsuper -h you will put the mails into a hold queue so you will not loose them either, you can delete the mails later.