Add option to not directly remove deleted mailboxes
When a mail account is deleted via the interface it's directly removed from the filesystem.
While we have a very nice undo action in the datalog history that does not bring back the data.
A regular backup will probably have a gap between when it finished and when the mailbox is deleted. In which changed can occur which we are not able to recover.
And in some cases it might be a compliance issue to purge mailboxes.
I suggest we add an option to delay the deletion.
One way could be to rename the mail folder to e.g. exmaple.com/mailuser-20210318222513
. Renaming will not hold-up the task queue with large mailboxes.
A cronjob could then process these further. There are multiple ways to do that and I expect opinions to vary on that.
- remove after x time
- compress into a tar
- sent to an archive location
- leave it and have your own cleanup task
- leave it for manual cleanup
As a bonus we could (under certain conditions) move it back when an undo action is performed.
I've started with code to rename mail_user and mail_domain directories. See the linked MR.
Thoughts?