Skip to main content

Delete old mail

A mailbox nobody looks at still grows: nobody signs in, nobody deletes anything, and the storage keeps filling.

Delete mail older than is the answer. Set a number of days, and mail older than that is deleted permanently, once a night, with nobody involved.

The setting is off by default. Off is the only value that deletes nothing.

What it deletes​

Everything that is old enough, with no exceptions. The ones you might expect don't exist:

  • Mail the user flagged or starred.
  • Mail the user never read.
  • The user's Sent mail and Drafts.
  • Every folder the user made.
Why there are no exceptions

A mailbox nobody uses is mostly unread mail, so an exception for unread mail would exempt exactly the mail this feature exists for. The same reasoning rules out the other exceptions.

Nothing this deletes can be recovered

There is no undelete, no holding area, and no per-message trash. The server removes the message file.

Email Trash is something else: it holds the raw mailbox of a deleted account, not messages the server deleted from a live mailbox.

What it does not do​

It is notBecause
A quotaA quota refuses new mail when the mailbox is full; this deletes old mail. Different halves of the same problem, and they work together. See Quotas and limits.
Retention or compliance archivingNo legal hold, no exemption, no audit record of what was removed.
A way to keep mail in Trash longerTrash and Spam already empty themselves: Trash after 30 days, Spam and Junk after 14. A shorter retention period covers those folders too, with everything else; a longer one leaves them alone. You can shorten that schedule, not extend it.

Where to set it​

ScopeWhereUse it as
One mailboxThe domain user's Email tab, in the Storage section, beside Mailbox Quota.The exception.
The whole domainServices → the zone → the Mail service → Account Policy.The rule. One value applies to every mailbox on the domain.

Like the other policies there, the domain value is a default that an individual user can override, unless you turn on Enforced. See Email policies.

A domain-wide value deletes mail everywhere at the next nightly run

This applies when you set the value and when you shorten it, so the form asks you to confirm and tells you how many mailboxes the change affects. A larger or empty value destroys nothing, so it needs no confirmation.

In scripts, the equivalent is host:user:edit --expire-age-days.

The age starts at arrival, not at the send date​

The clock starts when the server stored the message in this mailbox, not when somebody sent it. Two consequences:

  • Mail that arrives today but was sent years ago counts as new. The sender controls that header, so a deletion decision can't depend on it.
  • A restore from a backup restarts the clock for every restored message.
If expiry seems to have stopped

Look for a recent restore first. A mailbox restored from a one-year-old backup looks completely new to this feature and lives for another full retention period.

Before you turn it on​

  • Tell your users first if you set the value for the whole domain. Nobody should discover afterwards that their Sent mail is gone.
  • Watch for POP3 users. Someone who downloads mail with "leave a copy on the server" depends on the server to hold mail they haven't collected yet. A short retention destroys it.
  • Start with a long period. One year recovers the space of unused mailboxes without touching anyone who uses their account normally. You can shorten it later; you can't bring back what a too-short period removed on its first run.