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

A B alex.bryant at trancos.com
Mon Jan 31 21:04:21 UTC 2022


Thank you Aki.

I have updated as you suggested:

10-mail.conf
namespace virtual {
  location =
virtual:/etc/dovecot/virtual:INDEX=~/.virtual:CONTROL=~/.virtual:VOLATILEDIR=~/.virtual/
  type = private
  #prefix = virtual.
  separator = .
}

I manually added the directory structure and files:
[dovecot]# ll
total 32
drwxr-xr-x.   5 root root     121 Jan 31 14:41 ./
drwxr-xr-x. 115 root root    8192 Jan 31 11:05 ../
drwxr-xr-x.   3 root root      57 Jan  7 10:27 bak/
drwxr-xr-x.   2 root root    4096 Jan 25 15:05 conf.d/
-rw-r--r--.   1 root root    2658 Jan 25 16:52 dovecot.conf
-rw-r--r--.   1 root root    4391 Oct  8  2019 dovecot.conf-backup
-rw-r-----.   1 root dovecot  280 Jan 25 10:41 dovecot-sql.conf.ext
drwxr-xr-x.   4 root root      32 Jan 31 14:41 virtual/
[dovecot]# ll virtual/
total 0
drwxr-xr-x. 4 root root  32 Jan 31 14:41 ./
drwxr-xr-x. 5 root root 121 Jan 31 14:41 ../
drwxr-xr-x. 2 root root  29 Jan 31 14:41 All/
drwxr-xr-x. 2 root root  29 Jan 31 14:41 Flagged/
[dovecot]# ll virtual/All/
total 4
drwxr-xr-x. 2 root root 29 Jan 31 14:41 ./
drwxr-xr-x. 4 root root 32 Jan 31 14:41 ../
-rw-r--r--. 1 root root 10 Jan 31 14:31 dovecot-virtual
[]# cat virtual/All/dovecot-virtual
*
  all

I restarted the dovecot service. When I request to see the emails in the
virtual "All" folder (e.g. virtual.All), just like I would do with say the
Inbox or Trash folder, the virtual* folder gets created in the user
directory, but no emails are "found" or returned.

[Maildir]# pwd
/home/vmail/example.com/user.name/Maildir
[Maildir]# ll
total 80
drwxrwx---. 20 vmail vmail  4096 Jan 31 14:31  ./
drwxrwx---.  4 vmail vmail    37 Jan 31 14:19  ../
drwxrwx---.  5 vmail vmail   135 Jan 25 11:26  .Archive/
drwx------.  2 vmail vmail  4096 Jan 31 14:28  cur/
-rw-rw----.  1 vmail vmail   896 Jan 25 17:10  dovecot.index
-rw-rw----.  1 vmail vmail 22596 Jan 31 14:01  dovecot.index.cache
-rw-rw----.  1 vmail vmail 11160 Jan 31 14:28  dovecot.index.log
-rw-rw----.  1 vmail vmail  1896 Jan 28 17:15  dovecot.list.index
-rw-rw----.  1 vmail vmail  7752 Jan 31 14:36  dovecot.list.index.log
-rw-rw----.  1 vmail vmail   384 Jan 25 15:32  dovecot.mailbox.log
-rw-rw----.  1 vmail vmail  1887 Jan 25 11:35  dovecot-uidlist
-rw-rw----.  1 vmail vmail     8 Jan 31 14:31  dovecot-uidvalidity
-r--r--r--.  1 vmail vmail     0 Jan 24 16:35  dovecot-uidvalidity.61ef29a3
drwxrwx---.  5 vmail vmail   183 Jan 28 17:22  .Drafts/
drwxrwx---.  5 vmail vmail   135 Jan 25 11:24  .Junk/
-rw-rw----.  1 vmail vmail  1130 Jan 28 17:37  maildirsize
drwx------.  2 vmail vmail     6 Jan 25 11:34  new/
drwxrwx---.  5 vmail vmail   135 Jan 31 04:29  .Sent/
drwxrwx---.  5 vmail vmail   135 Jan 25 10:51 '.Sent Messages'/
-rw-rw----.  1 vmail vmail    43 Jan 25 10:50  subscriptions
drwx------.  2 vmail vmail     6 Jan 25 11:35  tmp/
drwxrwx---.  5 vmail vmail   135 Jan 25 13:23  .Trash/
drwxrwx---.  5 vmail vmail   135 Jan 31 14:36  .virtual.All/
drwxrwx---.  5 vmail vmail   135 Jan 31 14:28  .virtual.Flagged/
[Maildir]ll .virtual.All/
total 16
drwxrwx---.  5 vmail vmail  135 Jan 31 14:36 ./
drwxrwx---. 20 vmail vmail 4096 Jan 31 14:31 ../
drwxrwx---.  2 vmail vmail    6 Jan 31 14:31 cur/
-rw-rw----.  1 vmail vmail  868 Jan 31 14:31 dovecot.index.cache
-rw-rw----.  1 vmail vmail  472 Jan 31 14:36 dovecot.index.log
-rw-rw----.  1 vmail vmail   51 Jan 31 14:36 dovecot-uidlist
-rw-rw----.  1 vmail vmail    0 Jan 31 14:31 maildirfolder
drwxrwx---.  2 vmail vmail    6 Jan 31 14:31 new/
drwxrwx---.  2 vmail vmail    6 Jan 31 14:31 tmp/

Any suggestions what I should work on next to troubleshoot?  Again, my goal
is to be able to "fetch" all emails with the virtual.All, and all "flagged"
emails with virtual.Flagged.

Thank you.



---
[]# doveconf -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: example.com
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 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 = subscribe
    comment = All my messages
    special_use = \All
  }
  mailbox virtual.Flagged {
    auto = subscribe
    comment = All my flagged messages
    special_use = \Flagged
  }
  prefix = INBOX.
  separator = .
  type = private
}
namespace virtual {
  location =
virtual:/etc/dovecot/virtual:INDEX=~/.virtual:CONTROL=~/.virtual:VOLATILEDIR=~/.virtual/
  prefix =
  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/example.com/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 at example.com
}
protocol pop3 {
  pop3_uidl_format = %08Xu%08Xv
}
protocol imap {
  mail_plugins = " quota imap_quota virtual"
}


On Mon, Jan 31, 2022 at 12:30 AM Aki Tuomi <aki.tuomi at open-xchange.com>
wrote:

>
> > On 26/01/2022 19:48 A B <alex.bryant at trancos.com> wrote:
> >
> >
> > 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:
> > ---
>
> <snip/>
>
> You usually use these global virtual folders like this:
>
> namespace virtual {
>   location =
> virtual:/etc/dovecot/virtual:INDEX=~/.virtual:CONTROL=~/.virtual:VOLATILEDIR=~/.virtual/
>   ... rest of the settings
> }
>
>
> Then you create the dovecot-virtual files under /etc/dovecot/virtual like
>
> /etc/dovecot/virtual/Flagged/dovecot-virtual
>
> This lets you creat them automatically for all users.
>
> Aki
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://dovecot.org/pipermail/dovecot/attachments/20220131/df89e837/attachment.htm>


More information about the dovecot mailing list