Image

Knowledge base → Configuring the ManageSieve email filter for Roundcube webmail

[Virtual servers]
Date of publication: 31.05.2023

By default, the incoming mail filtering and rules module is disabled and not configured for processing. In this guide, we will enable and configure the ManageSieve module. This module allows you to distribute emails with specific content into your desired folders. For example, you can create a folder structure and separate emails by clients, partners into their own folders, grouping messages by sender address or subject into the folders you need. This setup adds convenience to working with email and facilitates quick searching for specific messages.

You can also order a pre-configured mail VPS server; more details about its setup can be found here:


Configure Dovecot Service

Add a new parameter:

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

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

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

Enable the 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 the configuration to the 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 permissions:

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',
];

Edit the plugin's own configuration file:

/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 log into Roundcube and add rules for processing our emails. Furthermore, the rules and folders we create, when using IMAP, apply to all mail clients. The rules are processed at the server level, and emails will be sorted on all your devices.





Nurul Islam
05.10.2025 14:36
I try to add filter my server. but failed. please help me
SYNAY support
05.10.2025 14:42
We found some errors in the description added by the HTML editor and fixed them. Please double-check your configuration.
There could be many reasons, check the service log.