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

Trash Plugin

The Trash plugin. When saving a message would make user go over quota, this plugin automatically deletes the oldest mails from configured mailboxes until the message can be saved within quota limits. Requires the quota plugin to be enabled.

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 = 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