Based on Debian 10 "Buster" environment.

Dovecot Sieve

Sieve is a script to tell how the delivered mail should be handled, deliver to the specific directory, forward, reject, or discard. This function is integrated to Dovecot as "Pigeonhole project", but the package name is simple dovecot-sieve in Debian.

Install

# apt install dovecot-sieve dovecot-managesieved
# ufw allow 'sieve'

"dovecot-sieve" is the sieve plugin for Dovecot LMTP.
"dovecot-managesieved" enables users to manage their own sieve scripts without ssh connection. Since virtual users don't have Unix accounts, and vmail can't log on as a shell user (it can read anybody's mail). The sieve users should access to ManageSieve from the local sieve editor through the port 4910 to edit only their own scripts.

Configure

Enable sieve plugin for Dovecot LMTP. Add "sieve" to /etc/dovecot/conf.d/20-lmtp.conf.

protocol lmtp {
  # Space separated list of plugins to load (default is global mail_plugins).
  mail_plugins = $mail_plugins sieve
}

The rest of the configuration is ok as default. Reload dovecot to enable sieve plugin.

# systemctl reload dovecot

Manage Sieve Scripts

Edit scripts

There used to be a Thunderbird add-on to edit the Sieve scripts. Due to the add-on policy change, that add-on went out of Thunderbird and under refurbishment to reborn as an independent Electron framework software. Now it's still a pre-release version, the release version is expected soon (I hope).
As far as my usage, pre-release version works well.

Make a sieve script and "activate" it to apply that rule. The application linked above has a "Reference" button on the edit screen.
Sieve script exapmles are available as follows.

Notice for sdbox

Since I'm using Dovecot original sdbox style, the directory structure is a bit different from the major Maildir style.

For example, "folder01" folder under the INOBX, the sieve script will be different in mailbox location.

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 will make actual directories with the delimiter '.' but sdbox will make as simple subdirectories.