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.

One of my users had some sort of debug output mailed to a address on my server..

Something "went wrong" and now I have 35000 mails in a inbox. I need to delete those mails, they are all from 1 specific address. The rest of the inbo needs to stay untouched.

How do I achieve this?

Platform: CentOS 5 with DirectAdmin, Dovecot, Exim.

share|improve this question
1  
I might not be able to post a full answer, but do take a look at: argon.org/~roderick/mbox-purge.html –  Jodie C Jul 12 '12 at 2:05

2 Answers 2

up vote 2 down vote accepted

Dovecot v.2 has an utility called doveadm that allow number of functions.

http://wiki2.dovecot.org/Tools/Doveadm/Expunge

Command

doveadm expunge -u jane.doe@example.org savedbefore 2w

delete all messages that older than two weeks from jane.doe's mailbox.

If you have dovecot v.1 you have to use system utility find:

find -E $userdir \
     -type f \
     -iregex ".*(cur|new).*" \
     ! -newerBt "1 month ago" \
     -exec rm {} \;
share|improve this answer
    
Thanks but how to delete all email that is received from one specific email address? –  edwardmp Jul 12 '12 at 9:32
    
Managed to do it like this: doveadm expunge -u myaccount@example.com mailbox Inbox FROM spammer@spam.com –  edwardmp Jul 12 '12 at 17:27

If you are familiar with python just write a quick script using the poplib

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.