Maildir++ quota
===============

The /Maildir++/ quota backend supports both *storage* and *messages* quota
limits. The calculation is done as specified in the Maildir++ specification
[http://www.inter7.com/courierimap/README.maildirquota.html].

The 'maildirsize' file in the Maildir root directory contains both the quota
limit information and the current quota status. It contains a header in format:

---%<-------------------------------------------------------------------------
<storage limit>S,<messages limit>C
---%<-------------------------------------------------------------------------

If you give *storage* or *messages* parameters to the quota plugin, Dovecot
makes sure that this header is kept up to date. If neither of the parameters
are given, Dovecot uses the limits in the 'maildirsize''s header. If the file
does not exist and the limit parameters are not given, no quota is enforced.

Example configuration:

---%<-------------------------------------------------------------------------
plugin {
  quota = maildir:storage=10240
}
---%<-------------------------------------------------------------------------

/!\ If the user has shell or file access to his Maildir, he can modify the
quota settings. Be sure to protect the file from overwriting by the user.

Trash mailbox
-------------

This feature works only with v1.0rc16 and later.

A "delete" operation in many clients means that the mail is copied to Trash
mailbox and then expunged from the original mailbox. This means that the delete
operation will fail if user is already over quota. If you wish to make this
work, you can use 'ignore' setting, which doesn't count the quota at all for
the given mailbox:

---%<-------------------------------------------------------------------------
plugin {
  quota = maildir:storage=10240:ignore=Trash
}
---%<-------------------------------------------------------------------------

Note that there can be only one ignore setting.

Quota rewrite
-------------

The quota plugin has already been rewritten. Since it uses different syntax, it
wasn't included in Dovecot v1.0, but you can get it as a patch for it:

http://dovecot.org/patches/quota-rewrite.diff

The 'ignore' setting no longer exists in the rewritten quota code. Instead you
can create a separate quota rule for the Trash mailbox:

---%<-------------------------------------------------------------------------
  # Quota limits are set using "quota_rule" parameters, either in here or in
  # userdb. It's also possible to give mailbox-specific limits, for example:
  #   quota_rule = *:storage=1048576
  #   quota_rule2 = Trash:storage=102400
  # User has now 1GB quota, but when saving to Trash mailbox the user gets
  # additional 100MB.
  #quota = maildir
---%<-------------------------------------------------------------------------

However what this does is slightly different from the ignore setting, so
perhaps it needs to be added back (maybe in a more configurable way to support
more mailboxes?).

(This file was created from the wiki on 2007-04-13 14:32)
