Per-folder retention: remove mail older than N days from a folder (optionally by sender) #648

Open
opened 2026-11-25 21:05:27 +00:00 by jcoffey-dev · 0 comments
Owner

Some folders only collect mail that stops mattering after a while: daily mail-scan digests, parcel tracking updates, delivery notices. A filter can't help, because Sieve runs once at delivery and can't act on age later. The only age-based cleanup today is the server-wide expungeTrashAfter (DataRetention), which applies only to Trash.

Proposal: a retention rule a user sets on their own folder

  • "Remove mail older than N days from this folder", optionally only mail from these senders or domains (e.g. only the tracking and digest senders, so a receipt filed in the same folder stays).
  • Removed mail goes to Trash, so it gets the normal Trash window before it's gone for good. Never a direct hard delete.
  • Flagged mail is never removed.
  • Runs in the existing daily expunge task (expungeSchedule), per account, in batches.
  • Shared mailboxes: Full members may set it, the same as the filters rule (#643).
  • Stored with the mailbox (or as a small per-account list keyed by mailbox id), and exported and imported with the account.
  • Webmail: folder settings → "Keep mail for…" (Forever / 30 / 60 / 90 / 365 days, plus the optional senders). An inbuxa-webmail issue follows once the server shape is settled.

Admin limits: a maximum number of rules per account, and the option to turn the feature off server-wide.

Tests: old mail from a listed sender moves to Trash; recent mail, flagged mail and other senders stay; a mailbox that is deleted or renamed keeps or drops its rule as expected; legal hold (AU) blocks removal of held mail.

Some folders only collect mail that stops mattering after a while: daily mail-scan digests, parcel tracking updates, delivery notices. A filter can't help, because Sieve runs once at delivery and can't act on age later. The only age-based cleanup today is the server-wide `expungeTrashAfter` (DataRetention), which applies only to Trash. **Proposal: a retention rule a user sets on their own folder** - "Remove mail older than N days from this folder", optionally only mail from these senders or domains (e.g. only the tracking and digest senders, so a receipt filed in the same folder stays). - Removed mail goes to Trash, so it gets the normal Trash window before it's gone for good. Never a direct hard delete. - Flagged mail is never removed. - Runs in the existing daily expunge task (`expungeSchedule`), per account, in batches. - Shared mailboxes: Full members may set it, the same as the filters rule (#643). - Stored with the mailbox (or as a small per-account list keyed by mailbox id), and exported and imported with the account. - Webmail: folder settings → "Keep mail for…" (Forever / 30 / 60 / 90 / 365 days, plus the optional senders). An inbuxa-webmail issue follows once the server shape is settled. **Admin limits:** a maximum number of rules per account, and the option to turn the feature off server-wide. **Tests:** old mail from a listed sender moves to Trash; recent mail, flagged mail and other senders stay; a mailbox that is deleted or renamed keeps or drops its rule as expected; legal hold (AU) blocks removal of held mail.
jcoffey-dev added this to the 27.7 milestone 2026-11-25 21:05:27 +00:00
jcoffey-dev self-assigned this 2026-11-26 00:21:38 +00:00
jcoffey-dev added the enhancement
priority
p3
labels 2026-11-26 00:23:37 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: inbuxa/inbuxa-server#648