1

Topic: Default domain settings - "mail group(s) of new user" is not working

============ Required information ====
- iRedMail version (check /etc/iredmail-release):  0.9.2
- Linux/BSD distribution name and version: CentOS 6.6
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Web server (Apache or Nginx): Apache
- Manage mail accounts with iRedAdmin-Pro?  iRedAdmin-Pro 2.1.2
- Related log if you're reporting an issue:
====

Hello,

I have a problem with default mail group for new users.
If i set default mail group for the domain and then create a new user, user wont be added to alias.
More over alias gets truncated if it contained email addresses before applying default mail group for the domain and user creation.

Steps to reproduce:

1) Create alias:
iRedAdmin-Pro -> Domains and Accounts -> example.org -> Aliases ->Add
Add alias all@example.org
    Who can send email to this list - Moderators
   
2) Set default mail group(s) of new user:

iRedAdmin-Pro -> Domains and Accounts -> example.org -> Advanced, Default mail group(s) of new user
Set checked alias all@example.org.

3) Create user:
Create user test123@example.org.
Member of mail aliases checkbox "all@example.org" is not checked.

4) Output from database:
Use vmail;
SELECT goto FROM `alias` WHERE address = 'all@example.org'
Result: CONTACT($mail, ',', goto)

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: Default domain settings - "mail group(s) of new user" is not working

Confirmed, it's a bug in the latest iRedAdmin-Pro-SQL. here's patch to fix it:

diff -r 307748d0296a libs/sqllib/user.py
--- a/libs/sqllib/user.py    Wed Jun 24 19:37:51 2015 +0800
+++ b/libs/sqllib/user.py    Sat Jun 27 12:37:17 2015 +0800
@@ -569,8 +569,8 @@
                 try:
                     if settings.backend == 'mysql':
                         conn.update('alias',
-                                    vars={'mail': mail, 'address': ali},
-                                    goto="""CONTACT($mail, ',', goto)""",
+                                    vars={'address': ali},
+                                    goto=web.sqlliteral("CONCAT(%s, ',', goto)" % web.sqlquote(mail)),
                                     where='address=$address')
                     elif settings.backend == 'pgsql':
                         conn.update('alias',

3

Re: Default domain settings - "mail group(s) of new user" is not working

The latest iRedAdmin-Pro-SQL update to version 2.1.3  has fixed the problem.