Postfix mysql catch-all电子邮件

时间:2016-03-04 22:57:08

标签: mysql email postfix-mta catch-all

我使用postfix,dovecot和mysql设置我的邮件服务器。现在我想添加一个包罗万象的地址来接收所有未指向特定用户的电子邮件。
这是我的实际配置:

virtual_transport = lmtp:unix:private/dovecot-lmtp
virtual_mailbox_domains = mysql:/etc/postfix/mysql-virtual-mailbox-domains.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual-mailbox-maps.cf
virtual_alias_maps = mysql:/etc/postfix/mysql-virtual-alias-maps.cf

查询别名(如上所述here):

SELECT destination FROM virtual_aliases WHERE source='%s' UNION ALL SELECT destination FROM virtual_aliases WHERE source='@%d' AND NOT EXISTS (SELECT destination FROM virtual_aliases WHERE source='%s')

我的用户表:

+----+-----------+------------+----------------------+
| id | domain_id | password   | email                |
+----+-----------+------------+----------------------+
|  1 |         1 | mypassword | catch-all@example.com
|  2 |         1 | mypassword | me@example.com

我的别名表:

+----+-----------+------------------------+-----------------------+
| id | domain_id | source                 | destination           |
+----+-----------+------------------------+-----------------------+
|  1 |         1 | @example.com           | catch-all@example.com
|  2 |         1 | another-me@example.com | me@example.com

据此,如果有人向another-me@example.com发送邮件,则应将其发送至me@example.com,而指向@ example.com的任何其他邮件应发送至catch-all @ example .COM。我测试了我的配置,它似乎工作:

user@myserver:~# postmap -q another-me@example.com mysql:/etc/postfix/mysql-virtual-alias-maps.cf
me@example.com
user@myserver:~# postmap -q test@example.com mysql:/etc/postfix/mysql-virtual-alias-maps.cf
catch-all@example.com

然后我做了一个真正的测试,将带有外部帐户的邮件发送到another-me@example.com和test@example.com:两者都发送到catch-all@example.com,而不是配置说。所以我的问题是我可以做错什么? 任何帮助将不胜感激

0 个答案:

没有答案
相关问题