====== Adding Sieve and ManageSieve support to dovecot ====== ===== Installing the Software ===== Assuming you have set up Dovecot and Postfix as per [[howtos:network_services:postfix_dovecot_mysql|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 [[http://slackbuilds.org/repository/14.1/network/dovecot-pigeonhole/?search=pigeonhole|pigeonhole]]. You must use the version of pigeonhole designed for the version of dovecot you are using as the abi changes from version to version. Once you have installed pigeonhole using the slackbuild, for example, using [[https://github.com/sbopkg/sbopkg/releases/download/0.37.0/sbopkg-0.37.0-noarch-1_cng.tgz|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 [[http://wiki2.dovecot.org/Pigeonhole/ManageSieve/Configuration|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 [[howtos:network_services:postfix_dovecot_mysql|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 also 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 [[https://github.com/thsmi/sieve/blob/master/nightly/0.2.3/sieve-0.2.3h.xpi?raw=true|here]] and should newer versions come out, they should be available from the [[https://github.com/thsmi/sieve/blob/master/nightly/|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 [[wiki:user:tim | User tim]] {{tag>howtos email postfix dovecot mysql ssl sieve}}