[Dovecot] trash plugin

Cor Bosman
Wed, 18 Apr 2012 08:22:32 -0000

The trash plugin docs say:

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

This leads me to believe that if a message cant be stored, the plugin would
avoid returning a quota error, but instead delete/expunge messages until the
original message can fit, and then complete the command.

But I see something different, at least using the plugin in imap (havent tried
it on lmtp). When I drag a message to a folder thats almost full, and the
message doesnt fit, I get an actual quota error:

23 uid copy 454343 "Spam"
23 NO [OVERQUOTA] Quota exceeded (mailbox for user is full)

After my client sees this error, I see the trash plugin creating space. But then
it's too late right? The client already has a visible error. Am I just
misunderstanding how the trash plugin is supposed to work?

Dovecot 2.1.4, config is on a set of test servers:

namespace {
  type = private
  separator = /
  inbox = yes
}

namespace {
  type = private
  separator = /
  inbox = no
  prefix = Spam/
  location =
maildir:/var/spool/mail/%1u/%1.1u/%u/.Spam:INDEX=/var/spool/mail/dovecot-control/indexes/%1u/%2u/%u/.Spam:CONTROL=/var/spool/mail/dovecot-control/%1u/%2u/%u/.Spam
  subscriptions = no
  list = yes
  hidden = yes
}

plugin {
  quota = maildir:Spam quota:ns=Spam/
  quota_rule = *:storage=5000K
}

My goal is to create a FIFO spam folder that never returns a quota error, but
instead just deletes the oldest emails as new spam comes in.

Regards,

Cor