Andreas Ntaflos
2008-Feb-21 15:40 UTC
[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 -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part. URL: <http://dovecot.org/pipermail/dovecot/attachments/20080221/b92e66c6/attachment-0002.bin>
Raphael Bittencourt S. Costa
2008-Feb-21 16:23 UTC
[Dovecot] Put existing mails (in Maildir) through sieve filter?
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
mouss
2008-Feb-22 19:22 UTC
[Dovecot] Put existing mails (in Maildir) through sieve filter?
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