This documentation is for Dovecot v2.x, see wiki1 for v1.x documentation.
Differences between revisions 1 and 27 (spanning 26 versions)
Revision 1 as of 2006-12-16 00:36:25
Size: 3006
Editor: TimoSirainen
Comment:
Revision 27 as of 2019-09-12 12:19:43
Size: 71
Comment: Moved to new doc
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
= Lazy expunge =

This plugin exists in Dovecot v1.0rc16 and later. Currently it works only with maildirs.

The idea behind this plugin is that expunged mails and deleted mailboxes stay around for a while, so that user can undelete them without assistance from sysadmin. The expunged mails won't be counted in user's quota. The plugin itself doesn't clean up the expunged messages, you'll have to do it some other way (see below).

The plugin is configured by defining 3 namespaces where the mails are moved. You can decide if you want the namespaces to be visible to clients, or if you want to show them only via some special webmail interface. The namespaces are:

 1. Expunged messages namespace. Whenever a message is expunged in mailbox ''<name>'', it's moved to a mailbox ''<name>'' in this namespace. The mailboxes are created automatically as needed.
 1. Deleted mailboxes namespace. Whenever a mailbox ''<name>'' is deleted, it's moved here with name ''<name>-YYYMMDD-hhmmss''. The timestamp is there so that the mailbox can be deleted multiple times. If the mailbox is deleted multiple times within a second, random 16bit hex value is appended to it.
 1. Expunged messages in a deleted mailbox namespace. When a mailbox is deleted and it has messages in its expunged namespace, the mailbox is moved from the expunged namespace to this namespace. The destination mailbox name is the same as in the 2nd namespace (ie. contains the same timestamp).

== Example configuration ==

{{{
namespace private {
  prefix = .EXPUNGED/
  separator = /
  location = maildir:~/Maildir/expunged
  hidden = yes
}
namespace private {
  prefix = .DELETED/
  separator = /
  location = maildir:~/Maildir/deleted
  hidden = yes
}
namespace private {
  prefix = .DELETED/.EXPUNGED/
  separator = /
  location = maildir:~/Maildir/deleted/expunged
  hidden = yes
}

plugin {
  lazy_expunge = .EXPUNGED/ .DELETED/ .DELETED/.EXPUNGED/
}
}}}

== Cleaning up ==

=== cronjob ===

Run something like this for each user every night (not actually tested if it works):

{{{
# delete a day old mails
find Maildir/expunged Maildir/deleted Maildir/deleted/expunged \
  -type f ! -cmin 1440 -print0 | xargs -0 rm
}}}

=== Trash plugin ===

[:Plugins/Trash:Trash plugin] with some help from [:Plugins/Quota:Quota plugin] could be used to keep the expunged and deleted mailboxes under a specified size. Unfortunately this requires CVS HEAD version of Dovecot, and probably even still requires some changes to the code.

=== Expire plugin ===

[:Plugins/Expire:Expire plugin] was created to keep track of mails in specific mailboxes, and expunge them when they've been there for a specified amount of time. It keeps an internal database (Berkeley DB) of all such mailboxes, so it doesn't have to go through all the mailboxes for all the users. Unfortunately again this requires CVS HEAD version of Dovecot, and it doesn't yet support wildcards in its list of tracked mailboxes.
Moved to https://doc.dovecot.org/plugin-settings/lazy_expunge_plugin/

None: Plugins/Lazyexpunge (last edited 2020-02-28 16:05:20 by MichaelSlusarz)