This is a follow up to my former article “Setting up a spamsafe Postfix server“. I will describe how to extend that installation to use Sieve for server side mail filtering in Dovecot. This article is based on an Ubuntu 10.04 installation but should work with other Linux distributions.
Filtering is done in the final mail delivery stage. Normally Postfix will write the messages directly into the Maildir of the user. We need to change the Postfix setting to use the Dovecot delivery agent. Edit the file /etc/postfix/main.cf
and add the following line:
After a restart, Postfix will forward received messages to Dovecot for delivery:
The deliver tool uses the configuration file /etc/dovecot/dovecot.conf
. Make sure that this file is globally readable:
Now we need to edit the file /etc/dovecot/dovecot.conf
and enable sieve and managesieve functionality. First enable the managesieve
protocol. Search the line with the protocols
entry and add managesieve
as a new protocol:
Now make sure that the section lda
is enabled and contains the following settings:
Set the path to your sieve scripts in the plugin
section:
You can now restart Dovecot:
Server side mail filterin should now be working. You can test it by setting up some rules. I would recommend to use a webmail client like Roundcube to do this. Roundcube has a very nice client plugin for the managesieve protocol.
Leave a Reply