Configuring Dovecot quota (Maildir++) to work with a workaround.org-style setup

Goal: Be able to limit users quota (mailbox size/max messages) individually with values stored in the SQL-scheme from the workaround.org tutorial. This howto only covers quota for IMAP.

Configuration

  1. Backup your /etc/dovecot/*.conf files
  2. Analyze what quota limit would be suitable for you (du -hs /home/vmail/example.org/*)
  3. Open /etc/dovecot/dovecot.conf and add the plugins "quota" and "imap_quota" and define location of the plugin directory
  4. Jump to the LDA section and add the "quota" plugin:
  5. Search for "userdb static". This section was defined in the workaround.org howto. Because we want to store quota settings in MySQL, we must add a section which takes precedence over that static section. So add the following section before userdb static:
  6. Now jump to the "plugin" section at the end of the file. We define the default quota size in KB here.
  7. As the user database stores things like mail/home directory, group and user IDs too, we have to return them somehow with the SQL query. Next we have to edit the /etc/dovecot/dovecot-sql.conf in order to fetch these fields. Add the following SQL query:
  8. So this query basically replaces the "userdb static" section. We select a static user- and group-id, mail home-directory and the quota limit in KB from the field quota_kb which you will have to add to the table virtual_users (type int 11).

    Possible field values:

Test setup

Optional: show quota limit in Horde/Imp

You must configure Imp to know that you use quota.
  1. Open horde/imp/config/servers.php and add this line to your configured server:
    Source: http://www.dovecot.org/list/dovecot/2007-September/025717.html
  2. Logout, login into Imp, quota usage should be displayed on top

Written on 12 January 2008 by Oliver Ladner. Last updated on 21 April 2008.