Image

Knowledge base → Configuring the ManageSieve email filter for Roundcube webmail

[Virtual servers]
Date of publication: 31.05.2023

By default, the module for filtering and rules for incoming mail is disabled and is not configured for processing. In this tutorial, we will enable and configure the ManageSieve module. This module allows you to distribute letters with specific content to the folders you need. For example, you can create a folder structure and divide letters by clients, partners into their folders, where for each address or subject of a letter, group letters in the folders you need. This setting adds the convenience of working with e-mail and a quick search for the desired letters.

You can also order a ready-made VPS mail server, you can see more about how it is configured here:

Set up the Dovecot service

Let's add a new parameter:

/etc/dovecot/conf.d/10-mail.conf

mail_home = /home/mail/%d/%u/sieve

Variables: %d - domain, %u - user.

Enable plugin

/etc/dovecot/conf.d/15-lda.conf

protocol lda {

Space separated list of plugins to load (default is global mail_plugins).

mail_plugins = $mail_plugins sieve }

Enable the plugin for roundcube:

/etc/dovecot/conf.d/20-managesieve.conf

protocols = $protocols sieve

Make the configuration active

service managesieve-login {
inet_listener sieve {
port = 4190
}
...
} 

Add configuration to file:

/etc/dovecot/conf.d/90-sieve.conf

plugin { sieve = /home/mail/%d/%u/sieve/dovecot.sieve sieve_global_path = /etc/dovecot/sieve/default.sieve sieve_dir = /home/mail/%d/%u/sieve sieve_global_dir = /etc/dovecot/sieve/global/ ... }

Add the missing directories specified in the configuration and assign rights:

mkdir -p /etc/dovecot/sieve/global
chown dovecot:dovecot -R /etc/dovecot/sieve
systemctl restart dovecot

Now let's configure the managesieve plugin in roundcube. Open the configuration file and enable the plugin:

/usr/share/nginx/html/webmail/config/config.inc.php

$config['plugins'] = [
...
'managesieve',
];

Let's edit the configuration file of the plugin itself:

/usr/share/nginx/html/webmail/plugins/managesieve/config.inc.php

$config['managesieve_port'] = 4190;
$config['managesieve_host'] = 'localhost';
$config['managesieve_default'] = '/etc/dovecot/dovecot.sieve';
$config['managesieve_script_name'] = 'dovecot.orig';

Now we can go to roundcube and add rules for processing our letters. Moreover, the rules and folders we created, in the case of using Imap, apply to all email clients. Rules are processed at the server level and letters will be sorted on all your devices.





No Comments Yet