I've configured dovecot with a sieve filtering (also I've configured roundcube, but this does not matter I think).

It's working fine, I've set up some filters. But now I've got a huge unfiltered INBOX folder which I don't want to filter manually.

Is there any way to say: "Hey, sieve! Scan specified folder for specified user and invoke some filters on it!" ?

Sieve as plugin enabled for two protocols: lda and lmtp:

protocol lda {
  mail_plugins = $mail_plugins sieve

protocol lmtp {
  postmaster_address = postmaster@example.com
  mail_plugins = sieve

To execute your filters on your existent mailbox you can manually run sieve-filter from the command line.

To (dry) run the sieve-script example.sieve as user test on the mailbox INBOX use the following command:

sieve-filter -v -C -u test /path/to/sieve/example.sieve 'INBOX'

Once you like the actions sieve would perform you can execute the script with adding -e for execute and -W to give sieve write access.

For more information look at the official man page: http://pigeonhole.dovecot.org/doc/man1/sieve-filter.1.html

| improve this answer | |
  • sadly, it seems like the duplicate-extension does not work in the sieve-filter context. – helt Aug 25 '16 at 14:24

It's easy :(

sudo su user-which-owns-mails
sieve-filter -e -W -u targetuset@domain.com /path/to/sieve/script.sieve INBOX
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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