Based on Debian 11 "Bullseye" environment.
Sieve is a script to control how emails should be handled. For example, delivering to the specific directory according to the headers.
This function is integrated into Dovecot as "Pigeonhole project" but the package name is dovecot-sieve in Debian.
# apt install dovecot-managesieved
Open the port.
# firewall-cmd --add-service=managesieve --permanent # firewall-cmd --reload
Enable sieve plugin for Dovecot LMTP. Add "sieve" to /etc/dovecot/conf.d/20-lmtp.conf mail plugins.
protocol lmtp { # Space separated list of plugins to load (default is global mail_plugins). mail_plugins = $mail_plugins sieve }
Reload dovecot to enable the sieve plugin.
# systemctl reload dovecot
There is a standalone Sieve Editor. If you use Roundcube as a mailer, it can manage sieve scripts with the built-in plugin.
* If you use the sieve editor, make a sieve script and "activate" it to apply that rule.
Sieve script examples are available as follows.
The directory structure between Maildir and sdbox (Dovecot original style) is slightly different.
For example, "folder01" under INOBX.
Maildir style
require "fileinto"; if header :contains ["from"] "folder01@example.com" { fileinto "INBOX.folder01"; }
sdbox style
require "fileinto"; if header :contains ["from"] "folder@example.com" { fileinto "INBOX/folder01"; }
Maildir uses the period for the folder delimiter, but sdbox makes actual subdirectories same as mail folder structure.
2021-09-20