Linux – run sieve on maildir

dovecotlinuxsieve

For my mailserver I have a dovecot, postfix and sieve setup.

I have several hundred mails in my maildir and have recently created some sieve rules for sorting them. Unfortunatelly the sieve rules are by design only applied to incoming messages. Therefore my question:

How can I run sieve against messages in an already existing maildir?

Thanks

— edit:

Thanks larsks

With the link you provided I ended up using:

mkdir todo
mkdir done
mv cur/* todo
for  i  in todo/*; do
    echo "Delivering message $i ..."
    /usr/lib/dovecot/deliver -d mail@example.de < $i && mv $i done/
done

which works like I charm. I can rerun this script for every new filter I create.

Best Answer

I have searched a lot too - rarely documentated.

Meanwhile there is a command

sieve-filter

for it, found on this blog https://mebsd.com/configure-freebsd-servers/dovecot-pigeonhole-sieve-filter-refilter-delivered-email.html for a howto