I have a table with users for my mail server. This table for imap authenfication in dovecot
+-------------+------------------+-------------------+------------------+------+------+---------------------------------------+--------+---------+---------------------------+
| user_name | domain_name | passwd | pwd_hash | uid | gid | mailbox_basepath | enable | quota | desc_rec |
+-------------+------------------+-------------------+------------------+------+------+---------------------------------------+--------+---------+---------------------------+
| logistic | piduna.pp.ua | loG-1990M | _no_hash_passwd_ | 2000 | 2000 | /home/maildir/piduna.pp.ua/ | 1 | 2048000 | box for logistic |
| 1c | piduna.pp.ua | 1c_user_1c | _no_hash_passwd_ | 2000 | 2000 | /home/maildir/piduna.pp.ua | 1 | 2048000 | Denisyuk V.V. |
| admin | piduna.pp.ua | AAddMmM1N | _no_hash_passwd_ | 2000 | 2000 | /home/maildir/piduna.pp.ua | 1 | 2048000 | Admin |
| al.service | piduna.pp.ua | Alumo_Serv4321 | _no_hash_passwd_ | 2000 | 2000 | /home/maildir/piduna.pp.ua | 1 | 2048000 | Alumo Service |
I need create aliases. For example, on it@vpiduna.pp.ua, i need to send email on admin@vpiduna.pp.ua and al.service@vpiduna.pp.ua. I do it. This table:
+------------------------+-------------------------------------------------+
| source | destination |
+------------------------+-------------------------------------------------+
| it@piduna.pp.ua | admin@piduna.pp.ua, al.service@piduna.pp.ua |
+------------------------+-------------------------------------------------+
In main.cf, i added this option:
virtual_alias_maps = mysql:/etc/postfix/mysql-virtual_aliases.cf
In mysql-virtual_aliases.cf:
user = root
password = myPassword
dbname = mail_db
query = SELECT destination FROM virtual_aliases WHERE source='%s'
hosts = 127.0.0.1
And this working. But, in my organization, i have alias for all users. It name is all@piduna.pp.ua. And, when i created new user, i need add it in alias all@piduna.pp.ua. How to create alias, that take all user accounts from my first table automatically?