I've published SQL code that can be used for this task here.
Currently, the dbmail-users utility can be used with the -e flag to empty a user's mailbox. It would be nice if the utility was extended to accept something like ”-o” which, when used with -e, would remove messages older than the value passed to -o.
dbmail-users -e -o 30 foo
would remove messages in foo's mailbox older than 30 days.
This would be useful as a maintenance approach (cron job) in order to deal with “business generic” accounts and system mail (e.g. monitoring and alerting) that tend to get overlooked.