Dovecot, enforcing retention policy
From Ubuntuwiki.net
If you need to enforce document retention policies on a Dovecot IMAP server, you can use the Lazy Expunge plugin to cause any mail or mailbox which has been deleted to be moved into a different namespace rather than actually deleted from the server.
With this configuration (which can simply be appended to the end of the existing dovecot.conf), an expunged_messages folder and a deleted_mailboxes folder will be created in /data/vmail, and they will contain exactly what it sounds like. In addition, an expunged_messages folder inside the deleted_mailboxes folder will be created if anybody should ever actually view one of the deleted mailboxes using dovecot, and expunge a message from it.
### LAZY_EXPUNGE CONFIGS # the default namespace namespace private { prefix = separator = / inbox = yes } # namespaces for lazy_expunge plugin: namespace private { prefix = .EXPUNGED/ separator = / location = maildir:/data/vmail/expunged_messages/%d/%n/Maildir hidden = yes list = no } namespace private { prefix = .DELETED/ separator = / location = maildir:/data/vmail/deleted_mailboxes/%d/%n/Maildir hidden = yes list = no } namespace private { prefix = .DELETED/.EXPUNGED/ separator = / location = maildir:/data/vmail/deleted_mailboxes/expunged_messages/%d/%n/Maildir hidden = yes list = no } protocol imap { mail_plugins = lazy_expunge } plugin { lazy_expunge = .EXPUNGED/ .DELETED/ .DELETED/.EXPUNGED/ }