1

Topic: Keeping mailboxes after deletion

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): 0.9.8
- Linux/BSD distribution name and version: CentOS 7.5
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL/MariaDB
- Web server (Apache or Nginx): Nginx
- Manage mail accounts with iRedAdmin-Pro?: Yes
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====

Can I limit the number of selections in the drop-down list of time frames that appears when a user deletes a mailbox? I don't need most of the options (certainly not "Keep mailbox forever"), and I don't want my users to think they have an option to keep deleted mailboxes and get them back later. A day is fine (or even a week) in case of an accident, but anything longer than a week serves no purpose for me.

I don't mind the full list appearing for the global admin, but normal admins should only see a day or a week, nothing longer.

2

Re: Keeping mailboxes after deletion

If I search for email accounts and select and then delete them, I am not asked how long I want to keep them for. If I go ahead and delete them they are still in the file system. In the vmail/deleted_mailboxes table they are listed with NULL in the delete_date column.

Does this mean I have to delete them manually?

And I already see some deleted accounts in there that are scheduled to be deleted in three years. sad

3

Re: Keeping mailboxes after deletion

I deleted a domain yesterday, and selected to keep the mailboxes for three months. In vmail/deleted_mailboxes/delete_date the dates were 0000-00-00. When the cron job ran a few hours later they were all deleted:

* Delete old mailboxes (5 in total).
* Deleted mailbox (info@example.com): /var/vmail/vmail1/example.com/i/n/f/info-2013.10.06.22.15.16/. Account was deleted at 2018-06-14 07:06:25. Mailbox was scheduled to be removed as soon as possible.

4

Re: Keeping mailboxes after deletion

craig wrote:

Can I limit the number of selections in the drop-down list of time frames that appears when a user deletes a mailbox?

Is it enough to let sysadmin define a list with allowed days in iRedAdmin-Pro config file? For example,

ALLOWED_DAYS = [1, 7, 14, 21, 28]

This way all normal domain admins just see these days, but global admin get extra days like 'keep forever'.

----

Does my reply help a little? How about buying me a cup of coffee ($5) as an encouragement?

buy me a cup of coffee

5

Re: Keeping mailboxes after deletion

craig wrote:

I deleted a domain yesterday, and selected to keep the mailboxes for three months. In vmail/deleted_mailboxes/delete_date the dates were 0000-00-00. When the cron job ran a few hours later they were all deleted:

This is a bug of iRedAdmin-Pro and fixed one week ago. here's patch to fix it:

--- a/libs/sqllib/domain.py    Wed May 30 21:45:30 2018 +0800
+++ b/libs/sqllib/domain.py    Fri Jun 08 12:20:30 2018 +0200
@@ -577,9 +577,9 @@
         sql_keep_days = web.sqlliteral('Null')
     else:
         if settings.backend == 'mysql':
-            sql_keep_days = 'DATE_ADD(CURDATE(), INTERVAL %d DAY)' % keep_mailbox_days
+            sql_keep_days = web.sqlliteral('DATE_ADD(CURDATE(), INTERVAL %d DAY)' % keep_mailbox_days)
         elif settings.backend == 'pgsql':
-            sql_keep_days = """CURRENT_TIMESTAMP + INTERVAL '%d DAYS'""" % keep_mailbox_days
+            sql_keep_days = web.sqlliteral("""CURRENT_TIMESTAMP + INTERVAL '%d DAYS'""" % keep_mailbox_days)
 
     sql_vars = {'domains': domains,
                 'admin': session.get('username'),

We will release a new iRedAdmin-Pro release soon.

----

Does my reply help a little? How about buying me a cup of coffee ($5) as an encouragement?

buy me a cup of coffee

6

Re: Keeping mailboxes after deletion

ZhangHuangbin wrote:

Is it enough to let sysadmin define a list with allowed days in iRedAdmin-Pro config file? For example,

ALLOWED_DAYS = [1, 7, 14, 21, 28]

This way all normal domain admins just see these days, but global admin get extra days like 'keep forever'.

Yes. that would be good. Thanks.

ZhangHuangbin wrote:

This is a bug of iRedAdmin-Pro and fixed one week ago. here's patch to fix it:
...
We will release a new iRedAdmin-Pro release soon.

Thanks. I'll wait for the new release.

7

Re: Keeping mailboxes after deletion

craig wrote:

Yes. that would be good. Thanks.

This has been implemented in development edition today, will be available in next stable release.

2 new options are available:

# How many days the normal domain admin can choose to keep the mailbox after
# account removal.
# To make it simpler, we use 30 days for one month, 365 days for one year.
DAYS_TO_KEEP_REMOVED_MAILBOX = [1, 7, 14, 21, 30, 60, 90, 180, 365]

# How many days the global domain admin can choose to keep the mailbox after
# account removal.
# To make it simpler, we use 30 days for one month, 365 days for one year.
# 0 means keeping forever.
DAYS_TO_KEEP_REMOVED_MAILBOX_FOR_GLOBAL_ADMIN = [0, 1, 7, 14, 21, 30, 60, 90, 180, 365, 730, 1095]

----

Does my reply help a little? How about buying me a cup of coffee ($5) as an encouragement?

buy me a cup of coffee

8

Re: Keeping mailboxes after deletion

ZhangHuangbin wrote:

This has been implemented in development edition today, will be available in next stable release.

Looks great. Thanks. smile