maildirquota(7)

NAME
maildirquota - experimental implementation of Maildir quotas

SYNOPSIS
MAILDIRQUOTA=quota,quota
to "$DEFAULT"

DESCRIPTION

maildrop has an experimental quota enforcement implementation. This is an option that is set at configuration time, and may be disabled.

Filesystem-based quotas should be used whenever possible. However filesystem-based quotas cannot be used in some situation, such as virtual mailboxes. If this experimental feature is enabled, reasonable quota enforcement can be implemented by maildrop to whatever extent it's possible to do so. After the quota feature is turned on, maildrop will consult the MAILDIRQUOTA variable before delivering a message into any maildir (this implementation is for maildirs only, and it will not affect delivery to mailbox files).

MAILDIRQUOTA is a list of one or more comma-separated quota specifications. A quota specification consists of a number, followed by a letter specifying the type of quota. Currently the following quota types are used: S - maximum size of messages in the maildir; C - message count in the maildir. If maildrop detects that the maildir has reached at least one of the specified quota limits it will print an error message and reject the message. For example:
MAILDIRQUOTA="5000000S,200C"

This specifies a quota of 5,000,000 bytes, or 200 messages, whichever comes first.

LIMITATIONS

This quota mechanism will only work as long as maildrop is the only application that's delivering messages to the maildir, or as long as other applications implement the same quota enforcement mechanism. The quota enforcement mechanism is described separately in the maildrop distribution.

Quota enforcement will still work, to a certain extent, if there are other application that deliver or modify messages in the maildir. However, quota enforcement may not kick in immediately when the maildir goes over quota, in fact the maildir can go over quota by quite a bit. Eventually, as long as maildrop is responsible for delivering the majority of messages, quota enforcement will kick in. Also, other sources of messages may also result in noticeable performance degradation, because quote recalculation will become noticeably more expensive (maildrop's way of generating maildir filenames is optimized towards very fast quota recalculation procedure).

Also keep in mind that this quota mechanism is generally useless if end users have the ability to access their accounts, and create filtering recipes. Even if MAILDIRQUOTA is set in the systemwide mail filter, users can simply override it in their own individual filtering recipes. In order for quota enforcement to be effective, in this situation, you must have the following code in your systemwide mail filter:
MAILDIRQUOTA=a,b
to "$DEFAULT"

However note that even in this case users will be able to place messages directly into their default maildirs using standard operating system tools.

Finally even under the best conditions this quota enforcement does have a small chance of a race condition where a maildir will go over quota by some amount. maildirs are designed for speed, and this quota implementation was designed in such a way as to have as little additional overhead as possible, compared to regular maildirs. To enforce an exact quota you would have to use some kind of a locking facility, which will impose a drastic performance degradation on the overall maildir performance. A decision has been made to avoid locking, with the only negative side effect being a possibility of going over quota in very low probability situations.

A way to minimize the risk of going over quota is to set reasonable quotas, in relation to maximum message sizes supported by your mail server. If you set your maildir quota to five megabytes, for example, it makes very little sense to configure your mail server to accept messages up to three megabytes long. Your maildir quota should be chosen so that it makes sense when compared to the maximum message size allowed by your mail server.

FOLDERS
This quota implementation is compatible with a popular extension to maildir which defines individual mail folders within a single maildir. However, in order to create a compatible folder, you MUST use the maildirmake command that comes with maildrop, and you MUST use the -f option to maildirmake, giving the name of the folder. Do not use maildirmake and specify the directory name of the maildir folder. Quota enforcement will not work if you do that.

VIRTUAL ACCOUNTS

The initial value for MAILDIRQUOTA can be set in userdb, the virtual account database. See makeuserdb(1) for more information.

BUGS

Are possible. This is a brand new, experimental, feature.

SEE ALSO
maildrop(1), maildirmake(1), maildropfilter(5), deliverquota(8).