Dovecot (and optionally VirtualMin)
Sometimes its necessary to purge old email from mailboxes given a period of time. This is most likely to remove old Spam or Deleted email but more importantly it can be used to enforce Quota's of INBOX.
This can simply be done with a shell command using doveadm
doveadm -v expunge -u someone.somedomain mailbox INBOX SAVEDBEFORE 52W
Here we're going to delete INBOX messages older than 52 weeks from someone.somedomain (or someone@somdomain depending on your configuration).
You can easily hack this around to delete from mailbox Spam for example.
Finally, you can PURGE (permenantly delete) everything that's been expurged using the command
doveadm purge -u someone.somdomain
(or someone@somdomain depending on configuration)
This is a fairly final process so its worth testing it out on a junk mailbox first to make sure you've got everything working before throwing it live. Just sayin is all.