我用 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
查询以检查别名(如此处所述):
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,而不是配置所说的。所以我的问题是我做错了什么?
任何帮助将不胜感激