Dovecot sieve, filter existing emails

D

Recently I’ve discovered, or rather was annoyed by, the fact that my emails aren’t sorted by my sieve script anymore.
I must have changed my Postfix configuration, because my mail transport was configured to be procmail instead of dovecot-lda. So I quickly changed my config to:
mailbox_command = /usr/libexec/dovecot/dovecot-lda -f "$SENDER" -a "$RECIPIENT"
and my filters started working again (for incoming emails).

Now I was stuck with all those unsorted emails in my inbox :( Fortunately one can use sieve-filter to sort existing emails on the server side. So for future reference here’s what i’ve done:
sieve-filter -eW .dovecot.sieve INBOX
Now all is where it’s supposed to be.

P.S.
Omit -eW and add -v if you want to first dry-run it and see if everything would be good.

About the author

Bartosz

iOS and OS X software engineer. Currently working in Berlin, Germany.

By Bartosz