This is an old revision of the document!
Table of Contents
Adding Sieve and ManageSieve support to dovecot
Installing the Software
Assuming you have set up Dovecot and Postfix as per Creating a Virtual Mail Server with Postfix, Dovecot and MySQL you may want some server-side filtering, and vacation response capabilities. This can be done using the sieve filter language, and edited by your virtual mail users using managesieve.
There is a slackbuild for dovecot that provides the sieve and managesieve functionality called pigeonhole.
Once you have installed pigeonhole using the slackbuild, for example, using sbopkg you can then configure it.
Configuring Pigeonhole
We will use a basic configuration, which can be expanded later if needed. copy the following 3 files from /usr/doc/dovecot-2.your.version/example-config/conf.d/ to /etc/dovecot/conf.d
20-managesieve.conf
90-sieve.conf
20-lmtp.conf
Edit /etc/dovecot/conf.d/20-managesieve.conf and uncomment the protocols line, service managesieve-login line, the inet_listener and port lines, and the two close braces lines. this will leave you with the following uncommented lines in the file
protocols = $protocols sieve service managesieve-login { inet_listener sieve { port = 4190 } } protocol sieve { }
that is managesieve enabled. now to configure sieve itself.
Edit /etc/dovecot/conf.d/90-sieve.conf in the plugin section make the sieve line read
sieve=file:/var/vmail/vhosts/%d/%n/sieve/scripts;active=/var/vmail/vhosts/%d/%n/sieve/.dovecot.sieve
this specifies where the user sieve scripts will be stored. (We do not use the default location of the virtual users email folder, as it is not recommended see, as it shows up as a directory in email clients.)
we also might as well configure an error log file for each user's scripts, so after that line, add a new line
sieve_user_log = file:/var/vmail/vhosts/%d/%n/sieve/sieve_error.log
Now edit /etc/dovecot/conf.d/20-lmtp.conf and uncomment the mail_plugins line in the protocol lmtp section and modify it to read
mail_plugins = $mail_plugins sieve
Open the firewall for ManageSieve
that is it for basic installation, although if you were following Creating a Virtual Mail Server with Postfix, Dovecot and MySQL you will also need to add port 4190 to the firewall with something like
iptables -A INPUT -p tcp --dport 4190 -m state --state NEW -j ACCEPT
You may want to restart dovecot to make sure it sees your newly added plugins
/etc/rc.d/rc.dovecot restart
Configuring Thunderbird for Sieve
ManageSieve as a tool to allow (virtual) users to create their own filters is not much use without a client. Fortunately there is one available for mozilla thunderbird. Unfortunately, the one available on the mozilla addons/extentions site does not work with any current version of thunderbird. Fortunately, to cut a long story short, the author has a more recent version which does work.
It can be downloaded here and should newer versions come out, they should be available from the nightly folder on the project's github site. Download this file to your computer, and manually install it into thunderbird.
Once this is installed, select the sieve-enabled mail account in thunderbird, then select tools - sieve message filters. Allow autodetect, and approve the certificate warning message (assuming you chose self-certified certificate in the howto). Now you can create sieve filters, which will act on your mail at the server. The plugin has some help for syntax and keywords, and there are plenty of examples on the internet for different tasks.
Sources
* Originally written by User tim