我的邮件服务器有一张包含用户的表格。此表格用于 dovecot 中的 imap 身份验证:
+-------------+------------------+-------------------+------------------+------+------+---------------------------------------+--------+---------+---------------------------+
| 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 |
接下来,我使用 MYSQL 中的 VIEW,在其中连接用户名和我的域名:
+------------------------------+-------------------------------------------------+-------------+------------------+------+------+---------------------------------------+---------+
| email_fqn | mailbox_userpath | user_name | domain_name | uid | gid | mailbox_basepath | quota |
+------------------------------+-------------------------------------------------+-------------+------------------+------+------+---------------------------------------+---------+
| [email protected] | /home/maildir/piduna.pp.ua/public/.logistic | .logistic | piduna.pp.ua | 2000 | 2000 | /home/maildir/piduna.pp.ua/public | 2048000 |
| [email protected] | /home/maildir/piduna.pp.ua/1c | 1c | piduna.pp.ua | 2000 | 2000 | /home/maildir/piduna.pp.ua | 2048000 |
| [email protected] | /home/maildir/piduna.pp.ua/admin | admin | piduna.pp.ua | 2000 | 2000 | /home/maildir/piduna.pp.ua | 2048000 |
| [email protected] | /home/maildir/piduna.pp.ua/al.service | al.service | piduna.pp.ua | 2000 | 2000 | /home/maildir/piduna.pp.ua | 2048000 |
我需要创建别名。例如,在[电子邮件保护],我需要发送电子邮件[电子邮件保护]和[电子邮件保护]。我做到了。这张表:
+------------------------+-------------------------------------------------+
| source | destination |
+------------------------+-------------------------------------------------+
| [email protected] | [email protected], [email protected] |
+------------------------+-------------------------------------------------+
在 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
这很有效。但是,在我的组织中,我为所有用户都设置了别名。它的名字是[电子邮件保护]。并且,当我创建新用户时,我需要将其添加到别名中[电子邮件保护]。如何创建别名,自动从我的第一个表中提取所有用户帐户?
我认为我需要用一个参数创建表:[电子邮件保护],然后创建 VIEW,在其中从第一个表中连接用户名和域?这样正确吗?如何正确执行此操作?