This documentation is for Dovecot v1.x, see wiki2 for v2.x documentation.

Trash Plugin

This requires quota plugin to be loaded and configured to use non-FS quota.

Normally if a message can't be saved/copied because it would bring user over quota, the save/copy fails with "Quota exceeded" error. The trash plugin can be used to avoid such situations by making Dovecot automatically expunge oldest messages from configured mailboxes until the message can be saved. If the new message is large enough that it wouldn't fit even if all messages from configured mailboxes were expunged, then none are and user gets the "Quota exceeded" error.

The configuration file is a text file where each line is in format: <priority> <mailbox name>. Mails are deleted in lowest -> highest priority number order.

Example dovecot.conf:

protocol imap {
  mail_plugins = quota trash

plugin {
  trash = /etc/dovecot-trash.conf

Example dovecot-trash.conf file

# Spam mailbox is emptied before Trash
1 Spam
# Trash mailbox is emptied before Sent
2 Trash
# If both Sent and "Sent Messages" mailboxes exist, the next oldest message
# to be deleted is looked up from both of the mailboxes.
3 Sent
3 Sent Messages

None: Plugins/Trash (last edited 2009-03-15 22:35:20 by localhost)