Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share
    
More details as this isn't enough information... –  Joey Sep 7 '09 at 20:03
    
It's not relevant to stackoverflow, either. –  skaffman Sep 7 '09 at 20:04
    
You need to say what OS and Mail Transfer Agent you're using. Windows+Exchange? Linux and Sendmail? Exim? Postfix? –  David Pashley Sep 7 '09 at 20:08
comments disabled on deleted / locked posts

migration rejected from stackoverflow.com Dec 31 '13 at 8:56

This question came from our site for professional and enthusiast programmers. Votes, comments, and answers are locked due to the question being closed here, but it may be eligible for editing and reopening on the site where it originated.

closed as off-topic by Rex, Dennis Kaarsemaker, MadHatter, Falcon Momot, Ward Dec 31 '13 at 8:56

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions must demonstrate a minimal understanding of the problem being solved. Try including attempted solutions, why they didn't work, and the expected results. See How can I ask better questions on Server Fault? for further guidance." – Rex, Dennis Kaarsemaker, MadHatter, Falcon Momot, Ward
If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer

you didn't mention which email server you use, assuming you use postfix

mailq >q.txt

grep MAILER-DAEMON q.txt | sed 's/ .*//' | sed 's/^/postsuper -h /' > md.sh

sh md.sh

if you want you can put everything 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.

share
add comment