Lazy-Expunge plugin documentation incomplete?
One of the Dovecot repository maintainers on GitHub recommended sending an eMail to you regarding the issue I encountered:
Documentation for lazy-expunge doesn't work https://github.com/dovecot/documentation/issues/1555
I converted from Dovecot 2.3 to Dovecot 2.4.1, which was not a minor upgrade. Anyway, I can't get the lazy-expunge plugin to work in 2.4.1 now. Here's my configuration file from 2.3 -- how can I get this working in 2.4.1? Thanks.
namespace inbox { mailbox EXPUNGED { autoexpunge = 32days autoexpunge_max_mails = 100000 #auto = create } }
Namespace for lazy_expunge plugin
namespace { prefix = EXPUNGED/ hidden = yes list = no subscriptions = no separator = / location = maildir:~/Maildir.deleted:INDEX= }
mail_plugins = $mail_plugins lazy_expunge acl plugin {
Move expunged messages into the .EXPUNGED namespace
lazy_expunge = EXPUNGED/
Only move to expunged storage if this is the last copy of the
message in the user´s account lazy_expunge_only_last_instance = yes
Exclude Drafts from lazy expunging
lazy_expunge_exclude = \Drafts
Copy of each message is done with hard links whenever possible
maildir_copy_with_hardlinks = yes
Define ACL so that user cannot list the .EXPUNGED mailbox
Example entry: .EXPUNGED owner rwstipekxa
acl = vfile:/etc/dovecot/dovecot.acl
dovecot.acl contains one line: EXPUNGED owner ip
Expunged messages most likely don't want to be included in quota:
quota_rule = EXPUNGED:ignore } #lazy_expunge_mailbox = EXPUNGED
Here's an example of someone else who encountered the same problem: https://www.dovecot.org/mailman3/archives/list/dovecot@dovecot.org/thr ead/25BXSHQWGQQ3ACVZSYF3O3LC4WROTUCI/
Randolf Richardson, CNA - randolf@inter-corporate.com Inter-Corporate Computer & Network Services, Inc. Beautiful British Columbia, Canada https://www.inter-corporate.com/
For 2.4 you would use
acl_driver = vfile acl_global_path = /etc/dovecot/dovecot.acl lazy_expunge_mailbox = EXPUNGED/ lazy_expunge_only_last_instance = yes
namespace inbox { mailbox EXPUNGED { autoexpunge = 32days autoexpunge_max_mails = 100000 } mailbox \Drafts { lazy_expunge_mailbox = } }
namespace ns { hidden = yes list = no prefix = EXPUNGED/ subscriptions = no
mailbox EXPUNGED { quota_ignore = yes } }
mail_plugins { acl = yes lazy_expunge = yes }
but you never did explain "how it does not work".
Aki
On 15/06/2026 19:17 EEST Randolf Richardson via dovecot <dovecot@dovecot.org> wrote:
One of the Dovecot repository maintainers on GitHub recommended sending an eMail to you regarding the issue I encountered:
Documentation for lazy-expunge doesn't work https://github.com/dovecot/documentation/issues/1555
I converted from Dovecot 2.3 to Dovecot 2.4.1, which was not a minor upgrade. Anyway, I can't get the lazy-expunge plugin to work in 2.4.1 now. Here's my configuration file from 2.3 -- how can I get this working in 2.4.1? Thanks.
namespace inbox { mailbox EXPUNGED { autoexpunge = 32days autoexpunge_max_mails = 100000 #auto = create } }
Namespace for lazy_expunge plugin
namespace { prefix = EXPUNGED/ hidden = yes list = no subscriptions = no separator = / location = maildir:~/Maildir.deleted:INDEX= }
mail_plugins = $mail_plugins lazy_expunge acl plugin {
Move expunged messages into the .EXPUNGED namespace
lazy_expunge = EXPUNGED/
Only move to expunged storage if this is the last copy of the
message in the user´s account lazy_expunge_only_last_instance = yes
Exclude Drafts from lazy expunging
lazy_expunge_exclude = \Drafts
Copy of each message is done with hard links whenever possible
maildir_copy_with_hardlinks = yes
Define ACL so that user cannot list the .EXPUNGED mailbox
Example entry: .EXPUNGED owner rwstipekxa
acl = vfile:/etc/dovecot/dovecot.acl
dovecot.acl contains one line: EXPUNGED owner ip
Expunged messages most likely don't want to be included in quota:
quota_rule = EXPUNGED:ignore } #lazy_expunge_mailbox = EXPUNGED
Here's an example of someone else who encountered the same problem: https://www.dovecot.org/mailman3/archives/list/dovecot@dovecot.org/thr ead/25BXSHQWGQQ3ACVZSYF3O3LC4WROTUCI/
Randolf Richardson, CNA - randolf@inter-corporate.com Inter-Corporate Computer & Network Services, Inc. Beautiful British Columbia, Canada https://www.inter-corporate.com/
dovecot mailing list -- dovecot@dovecot.org To unsubscribe send an email to dovecot-leave@dovecot.org
Thank you for your help, I appreciate it very much.
What I meant by "not working" is that the deleted messages were just
disappearing, without being placed in the ~/Maildir.deleted/ folder (which is the expected behaviour), and with no errors being logged.
I tried replacing my 16-lazy-expunge.conf file with what you
provided, and now, upon deletion, the IMAP4 client (Evolution on Linux in this case) reports an "expunge" operation error. The following errors now show up in the logs (this is on a test server that worked correctly before upgrading from 2.3 to 2.4.1):
2026-06-17T10:13:27.137678-07:00 mail02 dovecot: imap(nobody@example.com)<1232591><CUPOK3ZUdOIKAQHB>: Debug: Mailbox Deleted Items: UID 864: Mail metadata accessed 2026-06-17T10:13:27.137908-07:00 mail02 dovecot: imap(nobody@example.com)<1232591><CUPOK3ZUdOIKAQHB>: Debug: Mailbox EXPUNGED/: Mailbox opened 2026-06-17T10:13:27.138080-07:00 mail02 dovecot: imap(nobody@example.com)<1232591><CUPOK3ZUdOIKAQHB>: Error: Mailbox Deleted Items: UID 864: lazy_expunge: Couldn't open expunge mailbox: Failed to open mailbox EXPUNGED/: Invalid mailbox name 'EXPUNGED/': Ends with hierarchy separator 2026-06-17T10:13:27.138259-07:00 mail02 dovecot: imap(nobody@example.com)<1232591><CUPOK3ZUdOIKAQHB>: Debug: Mailbox Deleted Items: UID 864: Expunge requested 2026-06-17T10:13:27.138422-07:00 mail02 dovecot: imap(nobody@example.com)<1232591><CUPOK3ZUdOIKAQHB>: Debug: Mailbox Deleted Items: UID 865: Expunge requested 2026-06-17T10:13:27.138547-07:00 mail02 dovecot: imap(nobody@example.com)<1232591><CUPOK3ZUdOIKAQHB>: Debug: Mailbox Deleted Items: UID 866: Expunge requested 2026-06-17T10:13:27.138682-07:00 mail02 dovecot: imap(nobody@example.com)<1232591><CUPOK3ZUdOIKAQHB>: Debug: Mailbox Deleted Items: UID 867: Expunge requested 2026-06-17T10:13:27.138807-07:00 mail02 dovecot: imap(nobody@example.com)<1232591><CUPOK3ZUdOIKAQHB>: Debug: Mailbox Deleted Items: UID 868: Expunge requested 2026-06-17T10:13:27.138919-07:00 mail02 dovecot: imap(nobody@example.com)<1232591><CUPOK3ZUdOIKAQHB>: Error: Mailbox Deleted Items: Lazy-expunge transaction failed: Mailbox Deleted Items: UID 864: lazy_expunge: Couldn't open expunge mailbox: Failed to open mailbox EXPUNGED/: Invalid mailbox name 'EXPUNGED/': Ends with hierarchy separator
I did attempt removing the trailing slash, but the errors logged
remained the same.
I also tried to add the following lines to "mailbox EXPUNGED" stanza
(which is what I will be needing, although I'm unsure if this is the correct placement), which resulted in more errors that I think I should ignore at this point until the errors (above) are sorted:
mail_driver = maildir
mail_path = ~/Maildir.deleted
mail_index_private_path =
mail_cache_path =
Note: Some eMail clients delete directly instead of moving messages
to the "Deleted Items" (Trash) folders, and Dovecot 2.3 preserved this structure with its lazy-expunge configuration (which is a wonderfully helpful feature), which is all stored in the specified "mail_path" file system hierarchy separate from the user's mailbox.
Thanks!
For 2.4 you would use
acl_driver = vfile acl_global_path = /etc/dovecot/dovecot.acl lazy_expunge_mailbox = EXPUNGED/ lazy_expunge_only_last_instance = yes
namespace inbox { mailbox EXPUNGED { autoexpunge = 32days autoexpunge_max_mails = 100000 } mailbox \Drafts { lazy_expunge_mailbox = } }
namespace ns { hidden = yes list = no prefix = EXPUNGED/ subscriptions = no
mailbox EXPUNGED { quota_ignore = yes } }
mail_plugins { acl = yes lazy_expunge = yes }
but you never did explain "how it does not work".
Aki
On 15/06/2026 19:17 EEST Randolf Richardson via dovecot <dovecot@dovecot.org> wrote:
One of the Dovecot repository maintainers on GitHub recommended sending an eMail to you regarding the issue I encountered:
Documentation for lazy-expunge doesn't work https://github.com/dovecot/documentation/issues/1555
I converted from Dovecot 2.3 to Dovecot 2.4.1, which was not a minor upgrade. Anyway, I can't get the lazy-expunge plugin to work in 2.4.1 now. Here's my configuration file from 2.3 -- how can I get this working in 2.4.1? Thanks.
namespace inbox { mailbox EXPUNGED { autoexpunge = 32days autoexpunge_max_mails = 100000 #auto = create } }
Namespace for lazy_expunge plugin
namespace { prefix = EXPUNGED/ hidden = yes list = no subscriptions = no separator = / location = maildir:~/Maildir.deleted:INDEX= }
mail_plugins = $mail_plugins lazy_expunge acl plugin {
Move expunged messages into the .EXPUNGED namespace
lazy_expunge = EXPUNGED/
Only move to expunged storage if this is the last copy of the
message in the user´s account lazy_expunge_only_last_instance = yes
Exclude Drafts from lazy expunging
lazy_expunge_exclude = \Drafts
Copy of each message is done with hard links whenever possible
maildir_copy_with_hardlinks = yes
Define ACL so that user cannot list the .EXPUNGED mailbox
Example entry: .EXPUNGED owner rwstipekxa
acl = vfile:/etc/dovecot/dovecot.acl
dovecot.acl contains one line: EXPUNGED owner ip
Expunged messages most likely don't want to be included in quota:
quota_rule = EXPUNGED:ignore } #lazy_expunge_mailbox = EXPUNGED
Here's an example of someone else who encountered the same problem: https://www.dovecot.org/mailman3/archives/list/dovecot@dovecot.org/thr ead/25BXSHQWGQQ3ACVZSYF3O3LC4WROTUCI/
Randolf Richardson, CNA - randolf@inter-corporate.com Inter-Corporate Computer & Network Services, Inc. Beautiful British Columbia, Canada https://www.inter-corporate.com/
dovecot mailing list -- dovecot@dovecot.org To unsubscribe send an email to dovecot-leave@dovecot.org
Randolf Richardson, CNA - randolf@inter-corporate.com Inter-Corporate Computer & Network Services, Inc. Beautiful British Columbia, Canada https://www.inter-corporate.com/
participants (2)
-
Aki Tuomi
-
Randolf Richardson