2

Using Dovecot with a Maildir set-up, I am trying to get the virtual "All" and virtual "Flagged" mailboxes to work. I have gotten all the other typical mailboxes working (Archive, Trash etc...)

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

My 15-mailboxes.conf look like this (snippet):

namespace inbox {
  # These mailboxes are widely used and could perhaps be created automatically:

mailbox Archive { auto = subscribe special_use = \Archive } mailbox Drafts { auto = subscribe special_use = \Drafts }

...

If you have a virtual "All messages" mailbox:

mailbox virtual.All { auto = create special_use = \All comment = All my messages }

If you have a virtual "Flagged" mailbox:

mailbox virtual.Flagged { auto = create special_use = \Flagged comment = All my flagged messages } }

When I view the user's directory I see these folders were created:

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

dovecot-virtual:

*
  flagged

A couple other relevant configurations I have in place:

10-mail.conf:

namespace inbox {
  type = private
  separator = .
  prefix = INBOX.
  inbox = yes
}

20-imap.conf:

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

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, it should return that message that is flagged in the inbox as a result.

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.

2 Answers2

1

I was able to get it figured out with help from the official Dovecot mailing-list:

https://dovecot.org/pipermail/dovecot/2022-February/124060.html

1

Using the answers from the mentioned Dovecot mailing-list, I could make Flagged work with the following configuration settings:

mail_plugins = $mail_plugins virtual

namespace virtual { location = virtual:/etc/dovecot/virtual:INDEX=%h/virtual:CONTROL=%h/virtual:VOLATILEDIR=%h/virtual/ type = private prefix = virtual. separator = . hidden = yes list = no }

namespace inbox { mailbox virtual.Flagged { special_use = \Flagged } }

The contents of the /etc/dovecot/virtual/Flagged/dovecot-virtual file:

*
  flagged

I've also created the virtual/Flagged directory in my home dir. (It may work without it, but dovecot won't be able to create its indexes.)

After this the Flagged folder didn't appear in any listing, but I could access it from mutt using the imaps://myserver:993/virtual/Flagged url, and it listed my flagged emails fine.

Zoltan Peller
  • 206
  • 2
  • 4