在 Postfix 2.10.2 中,我设置了多个域和多个虚拟别名来为本地用户分配邮件地址。只要我不添加包罗万象,它就可以正常工作。
在我使用虚拟别名之前,我定义了一个包罗万象的东西
local_recipient_maps =
luser_relay = catchall
Run Code Online (Sandbox Code Playgroud)
但由于我需要整理来自不同域的邮件地址,我不得不使用虚拟别名。
现在postfix.org说我应该这样做,我做到了:
/etc/postfix/main.cf:
virtual_alias_domains = example.com
virtual_alias_maps = hash:/etc/postfix/virtual
Run Code Online (Sandbox Code Playgroud)
/etc/postfix/虚拟:
postmaster@example.com account1
info@example.com account1
sales@example.com account2
@example.com catchall
Run Code Online (Sandbox Code Playgroud)
但是如果我这样做,catchall 地址会抓取我所有的邮件,而不仅仅是发送到未明确定义的地址的邮件。为什么会这样,我该如何更改它?
我做了 postmap virtual 并重新启动了 Postfix。日志中没有错误,它只是将交付记录到 catchall 地址。并且有一个警告“不要在 mydestination 和 virtual_alias_domains 中列出域 example.com”,但我没有这样做!我什至没有 mydestination 指令。(下面的配置中有一个,但我在 NickW 建议之后添加了它。)
这是我的完整配置:
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
broken_sasl_auth_clients = yes
config_directory = /etc/postfix
home_mailbox = Maildir/
inet_interfaces = all
inet_protocols = all
mailbox_command = /usr/lib/dovecot/deliver -c …
Run Code Online (Sandbox Code Playgroud)