[Dovecot] Put existing mails (in Maildir) through sieve filter?
Hello list,
the scenario: A user has about 30k mails in his Maildir (all in INBOX) and needs to apply filtering. Provided he writes a working .dovecot.sieve script, is there a way to put all those already delivered mails through Dovecot's LDA and thus have the sieve filter rules applied? Or is there any other way to apply sieve rules to already delivered mails?
TIA
Andreas
Andreas "daff" Ntaflos Vienna, Austria
GPG Fingerprint: 6234 2E8E 5C81 C6CB E5EC 7E65 397C E2A8 090C A9B4
Andreas,
You can write a shell script to do this for you.
cd ~/Maildir/cur
for i in *; do /usr/local/libexec/dovecot/deliver -d user < $i; rm -f $i; echo "Message $i"; done
On Thu, 2008-02-21 at 16:40 +0100, Andreas Ntaflos wrote:
Hello list,
the scenario: A user has about 30k mails in his Maildir (all in INBOX) and needs to apply filtering. Provided he writes a working .dovecot.sieve script, is there a way to put all those already delivered mails through Dovecot's LDA and thus have the sieve filter rules applied? Or is there any other way to apply sieve rules to already delivered mails?
TIA
Andreas
[]s,
Raphael Costa
On Thursday 21 February 2008 17:23:04 Raphael Bittencourt S. Costa wrote:
You can write a shell script to do this for you.
cd ~/Maildir/cur
for i in *; do /usr/local/libexec/dovecot/deliver -d user < $i; rm -f $i; echo "Message $i"; done
Thanks for the reply! I had no idea it could be so easy :)
Much appreciated.
Andreas
Andreas Ntaflos Vienna, Austria
GPG Fingerprint: 6234 2E8E 5C81 C6CB E5EC 7E65 397C E2A8 090C A9B4
Raphael Bittencourt S. Costa wrote:
Andreas,
You can write a shell script to do this for you.
cd ~/Maildir/cur
for i in *; do /usr/local/libexec/dovecot/deliver -d user < $i; rm -f $i; echo "Message $i"; done
it would be safer to move the messages to another directory before running the loop, and moving the delivrered ones to another dir instead of deleting them.
cd ~/Maildir mkdir todo mkdir done cp cur/* todo for i in todo/*; do echo "Delivering message $i ..." /path/to/deliver -d user < $i && mv $i done/ done
participants (3)
-
Andreas Ntaflos
-
mouss
-
Raphael Bittencourt S. Costa