With iRedAdmin-Pro for MySQL or PostgreSQL edition, you can find function 'deleteAccounts' in libs/mysql/core.py (or libs/pgsql/core.py), just place you code before 'try:'.
def deleteAccounts(self, accounts, accountType): ... elif accountType == 'user': ... try: ...
You need to query SQL database to get maildir path of users first, then delete it.
WARNING: It may take long time to delete mailbox if it contains many mail messages.
PERSONALLY, i prefer log the maildir path in SQL db first, then execute it with a cron job. You can also keep the mailbox for as long as you want, for example, 90 days for audit.
I will achieve this in future release.
Thank you, I'll also agree with your usage of an additional DB to store removed users for a time period and have a cron job clean up the files after a set amount of time.
Should I have success, I'll repost here should I come up with a working solution.
Thanks again!