How to use virtual "All" and "Flagged" mailbox?

A B alex.bryant at trancos.com
Wed Jan 26 17:48:19 UTC 2022


Hello,

I'm trying to use the virtual "All" and "Flagged" mailboxes as described in
15-mailboxes.conf.

The information here (
https://doc.dovecot.org/configuration_manual/virtual_plugin/) doesn't
really touch on how to actually interact with the virtual mailboxes.

My presumption is that when I mark an email message in the Inbox as FLAGGED
(and I can confirm the \Flagged flag has been set) then I should then be
able to either (1) see a copy of that message in the virtual.Flagged
folder, or (2) when I use an imap command to get the message nums or
whatever from the virtual.Flagged folder/mailbox, it should return the
message that is flagged in the inbox as a result.

Additionally, I'm presuming that for each new user that automatically gets
added, I would have to create my own script that would add the
dovecot-virtual file, dovecot doesn't do that on its own.

When I view the user's directory I see these folders were created:
---
[snippet]
drwxrwx---.  5 vmail vmail   135 Jan 25 17:01  .virtual.All/
drwxrwx---.  5 vmail vmail   158 Jan 25 17:14  .virtual.Flagged/
[.virtual.Flagged]# ll
total 20
drwxrwx---.  5 vmail vmail  158 Jan 25 17:14 ./
drwxrwx---. 20 vmail vmail 4096 Jan 25 17:33 ../
drwxrwx---.  2 vmail vmail    6 Jan 25 16:58 cur/
-rw-rw----.  1 vmail vmail  868 Jan 25 16:58 dovecot.index.cache
-rw-rw----.  1 vmail vmail  384 Jan 25 17:01 dovecot.index.log
-rw-rw----.  1 vmail vmail   51 Jan 25 17:01 dovecot-uidlist
-rw-r--r--.  1 vmail vmail    8 Jan 25 17:14 dovecot-virtual
-rw-rw----.  1 vmail vmail    0 Jan 25 16:58 maildirfolder
drwxrwx---.  2 vmail vmail    6 Jan 25 16:58 new/
drwxrwx---.  2 vmail vmail    6 Jan 25 16:58 tmp
[.virtual.Flagged]# cat dovecot-virtual
*
  flagged
---

Side note: This set-up uses the php-imap library to interact with Dovecot.

Any help, or just concept of how the virtual/All virtual/Flagged
directories work would be really appreciated.


CONFIGURATION:

dovecot -n
# 2.3.8 (9df20d2db): /etc/dovecot/dovecot.conf
# OS: Linux 4.18.0-348.2.1.el8_5.x86_64 x86_64 CentOS Linux release
8.5.2111 xfs
# Hostname: [DOMAIN REDACTED]
auth_debug = yes
auth_verbose = yes
auth_verbose_passwords = yes
first_valid_uid = 1000
lda_mailbox_autocreate = yes
log_timestamp = "%Y-%m-%d %H:%M:%S "
mail_location = maildir:/home/vmail/%d/%n/Maildir
mail_plugins = " quota"
mbox_write_locks = fcntl
namespace {
  location = virtual:/home/vmail/%d/%n/Maildir/virtual:LAYOUT=maildir++
  prefix = virtual.
  separator = .
  type = private
}
namespace inbox {
  inbox = yes
  location =
  mailbox Archive {
    auto = subscribe
    special_use = \Archive
  }
  mailbox Drafts {
    auto = subscribe
    special_use = \Drafts
  }
  mailbox Junk {
    auto = subscribe
    special_use = \Junk
  }
  mailbox Sent {
    auto = subscribe
    special_use = \Sent
  }
  mailbox "Sent Messages" {
    auto = subscribe
    special_use = \Sent
  }
  mailbox Trash {
    auto = subscribe
    special_use = \Trash
  }
  mailbox virtual.All {
    auto = create
    comment = All my messages
    special_use = \All
  }
  mailbox virtual.Flagged {
    auto = create
    comment = All my flagged messages
    special_use = \Flagged
  }
  prefix = INBOX.
  separator = .
  type = private
}
passdb {
  args = /etc/dovecot/dovecot-sql.conf.ext
  driver = sql
}
passdb {
  driver = pam
}
plugin {
  quota = maildir:User quota
  quota_grace = 10%%
  quota_max_mail_size = 30M
  quota_rule = *:storage=100M
  quota_rule2 = INBOX.Trash:storage=+10M
  quota_status_nouser = DUNNO
  quota_status_overquota = 552 5.2.2 Mailbox is full
  quota_status_success = DUNNO
}
protocols = imap pop3
service auth-worker {
  user = root
}
service auth {
  unix_listener /var/spool/postfix/private/auth {
    group = postfix
    mode = 0666
    user = postfix
  }
  unix_listener auth-master {
    mode = 0600
    user = vmail
  }
  unix_listener auth-userdb {
    mode = 0600
    user = vmail
  }
  user = dovecot
}
service imap-login {
  inet_listener imaps {
    port = 993
    ssl = yes
  }
}
service pop3-login {
  inet_listener pop3s {
    port = 995
    ssl = yes
  }
}
service quota-status {
  client_limit = 1
  executable = quota-status -p postfix
  inet_listener {
    port = 12340
  }
}
service stats {
  unix_listener stats-reader {
    group = vmail
    mode = 0660
    user = vmail
  }
  unix_listener stats-writer {
    group = vmail
    mode = 0660
    user = vmail
  }
}
ssl = required
ssl_cert = </etc/letsencrypt/live/[DOMAIN REDACTED]/fullchain.pem
ssl_cipher_list = PROFILE=SYSTEM
ssl_key = # hidden, use -P to show it
userdb {
  args = uid=5000 gid=5000 home=/home/vmail/%d/%n allow_all_users=yes
  driver = static
}
userdb {
  driver = passwd
}
protocol lda {
  auth_socket_path = /var/run/dovecot/auth-master
  log_path = /home/vmail/dovecot-deliver.log
  postmaster_address = postmaster@[DOMAIN REDACTED]
}
protocol pop3 {
  pop3_uidl_format = %08Xu%08Xv
}
protocol imap {
  mail_plugins = " quota imap_quota virtual"
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://dovecot.org/pipermail/dovecot/attachments/20220126/e3124c27/attachment.htm>


More information about the dovecot mailing list