Configurable retention / auto-expunge for arbitrary folders (Sent in particular)

Right now DataRetention only lets us auto-expunge Trash and Junk via expungeTrashAfter. There is no way to apply a retention period to any other folder.

The folder where this actually hurts is Sent.

On business mailboxes Sent grows without bound. It’s the one folder users never clean up, and it’s the one that receives a copy of every outgoing attachment. Over a few years it becomes the single largest contributor to store size - and every one of those blobs stays in the blob store indefinitely. On spinning disks, eventually removing years of accumulated messages in one pass is a meaningful I/O event, which is exactly the situation a gradual retention policy would avoid.

What I’d like to see

A per-folder retention policy on DataRetention. Two possible shapes, either would solve it:

  • Minimal: an expungeSentAfter field alongside expungeTrashAfter.
  • Better: a list of rules mapping mailbox role or name to a duration, so operators can set policy for Sent, Archive, or custom folders in one place.

An override at account or tenant level would be a welcome addition - a shared/functional mailbox and a personal one rarely want the same policy - but the global setting alone would already cover most of the need.

Current workaround

An external cron job that walks every account over IMAP using admin impersonation, does SEARCH BEFORE <date>, then stores \Deleted and expunges. It works, but it runs out-of-band from the server’s own expunge task, and every operator who wants this ends up writing the same script.

Minor side note

expungeSubmissionsAfter reads like it covers sent mail, but it applies to EmailSubmission records rather than messages in the Sent folder. That’s an easy one to misread, especially for someone going through the docs looking for exactly this feature - a clarifying line in the field description might save a few support questions.