1.5. Automatically subscribing users to IMAP mailboxes


Typically, IMAP server administrators want Dovecot to automatically create certain mailboxes, such as Sent and Trash, and subscribe the users to them. You can set this in the configuration files.

Additionally, you can define special-use mailboxes. IMAP clients often support defining mailboxes for special purposes, such as for sent emails. To avoid that the user has to manually select and set the correct mailboxes, IMAP servers can send a special-use attribute in the IMAP LIST command. Clients can then use this attribute to identify and set, for example, the mailbox for sent emails.

Prerequisites

  • Dovecot is configured.

Procedure

  1. Update the inbox namespace section in the /etc/dovecot/conf.d/15-mailboxes.conf file:

    1. Add the auto = subscribe setting to each special-use mailbox that should be available to users, for example:

      namespace inbox {
        ...
        mailbox Drafts {
          special_use = \Drafts
          auto = subscribe
        }
      
        mailbox Junk {
          special_use = \Junk
          auto = subscribe
        }
      
        mailbox Trash {
          special_use = \Trash
          auto = subscribe
        }
      
        mailbox Sent {
          special_use = \Sent
          auto = subscribe
        }
        ...
      }

      If your mail clients support more special-use mailboxes, you can add similar entries. The special_use parameter defines the value that Dovecot sends in the special-use attribute to the clients.

    2. Optional: If you want to define other mailboxes that have no special purpose, add mailbox sections for them in the user’s inbox, for example:

      namespace inbox {
        ...
        mailbox "Important Emails" {
          auto = <value>
        }
        ...
      }

      You can set the auto parameter to one of the following values:

      • subscribe: Automatically creates the mailbox and subscribes the user to it.
      • create: Automatically creates the mailbox without subscribing the user to it.
      • no (default): Dovecot neither creates the mailbox nor does it subscribe the user to it.
  2. Reload Dovecot:

    # systemctl reload dovecot

Verification

  • Use an IMAP client and access your mailbox.

    Mailboxes with the setting auto = subscribe are automatically visible. If the client supports special-use mailboxes and the defined purposes, the client automatically uses them.

Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2026 Red Hat
返回顶部