protocols = imap pop3

mail_driver = maildir
mail_home = /srv/vmail/%{user | lower}
mail_path = ~/mail
mailbox_list_layout = maildir++
mailbox_list_storage_escape_char = ^
# MailHub's Maildir adapter stores folder names in IMAP Modified UTF-7 so it
# remains compatible with imported Vesta/Dovecot Maildir++ trees.
mailbox_list_utf8 = no
mail_uid = 1000
mail_gid = 1000

mail_plugins {
  acl = yes
}
acl_driver = vfile
acl_globals_only = yes

ssl = yes

namespace inbox {
  inbox = yes
  separator = /

  # A shared-mailbox Webmail session is still authenticated as the mailbox
  # address, so Dovecot otherwise treats it as the owner. This group-override
  # rule takes precedence over owner rights and limits delegates to listing,
  # reading, and updating only the \Seen flag.
  acl group-override=mailhub_webmail_readonly {
    rights = lrs
  }

  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 Trash {
    auto = subscribe
    special_use = \Trash
  }
}

service imap-login {
  chroot =
  process_min_avail = 1
  process_limit = 24

  inet_listener imaps {
    ssl = yes
  }
}

service pop3-login {
  chroot =
  process_min_avail = 0
  process_limit = 8

  inet_listener pop3s {
    ssl = yes
  }
}
