Adding virtual folders to an existing dovecot installation

Christian Wolf account+dovecot at
Thu May 6 16:11:41 EEST 2021

Hello dear dovecot mailinglist,

I am having a dovecot installation that is working so far (together with sieve 
and managesieve).

Now, I found the possibility to add a virtual folder to the server promising. 
I sort various mails using a per-user sieve script into subfolders. This works 
well on the latop but the mobile device does not like too many folders to 
check. So, I wanted to create a virtual inbox that holds all unread messages. 
I found this documentation:

Now, I have first one question: When I use the virtual folder and read a 
message/mark it as read, will this be reflected on the underlaying folder or 
will it cause trouble on dovecot?

As far as I understand, usage of sieve filtering and the virtual plugin is 
considered critical as mentioned in the documentation. This is due to the 
fact, that the virtual mailboxes are read-only by default (unless a folder is 
prefixed with a !-symbol). Sieve will try to filter the virtual folder as well 
be default and moving a message to another folder will fail the read-only 

Honestly, I do not get the content of
configuration_manual/virtual_plugin/#sieve-filters-with-virtual-mailboxes by 
100%. The first paragraph indicates that sieve plus virtual mailboxes are a 
complete no-go, while the second indicates that a safe configuration is needed. 
Could someone please elaborate this a bit more?

I have not yet changed anything as I did not want blindly break my production 
mail system. The current (unaltered) configuration I will attach below.

Bonus question: Is it possible to restrict the effect of the virtual plugin to 
certain (virtual) user accounts?

Thank you very much

# dovecot --version
2.3.13 (89f716dc2)

#dovecot -n
# 2.3.13 (89f716dc2): /etc/dovecot/dovecot.conf
# Pigeonhole version 0.5.13 (cdd19fe3)
# OS: Linux 5.11.2-arch1-1 x86_64  
# Hostname: server-hh.hh.lupus
auth_mechanisms = plain login
mail_location = maildir:~/Maildir
managesieve_notify_capability = mailto

managesieve_sieve_capability = fileinto reject envelope encoded-character 
vacation subaddress comparator-i;ascii-numeric relational regex imap4flags copy 
include variables body enotify environment mailbox date index ihave duplicate 
mime foreverypart extracttext

namespace inbox {
  inbox = yes
  location = 
  mailbox Drafts {
    auto = subscribe
    special_use = \Drafts
  mailbox Junk {
    special_use = \Junk
  mailbox Sent {
    auto = subscribe
    special_use = \Sent
  mailbox "Sent Messages" {
    special_use = \Sent
  mailbox Templates {
    auto = subscribe
  mailbox Trash {
    auto = subscribe
    special_use = \Trash
  prefix = 

passdb {
  args = scheme=PLAIN username_format=%n /home/.vmail/%d/etc/shadow
  driver = passwd-file
plugin {
  sieve = file:~/sieve;active=~/.dovecot.sieve
  stats_refresh = 30 secs
  stats_track_cmds = yes
protocols = imap lmtp sieve
service auth {
  unix_listener /var/spool/postfix/private/auth {
    group = postfix
    mode = 0660
    user = postfix
service stats {
  fifo_listener stats-mail {
    mode = 0600
    user = vmail
ssl = required
ssl_cert = </etc/letsencrypt/live/dovecot/fullchain.pem
ssl_cipher_list = ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-
ssl_dh = # hidden, use -P to show it
ssl_key = # hidden, use -P to show it
ssl_prefer_server_ciphers = yes
userdb {
  args = uid=vmail gid=vmail home=/home/.vmail/%d/mails/%n
  driver = static
protocol lmtp {
  mail_plugins = " sieve"
  postmaster_address = postmaster at
protocol lda {
  mail_plugins = " sieve"
protocol imap {
  mail_plugins = " old_stats"

More information about the dovecot mailing list