Postfix,虚拟别名和catchall为未定义的地址

在Postfix 2.10.2中,我有一个安装了多个域和几个虚拟别名的邮件地址给本地用户。 只要我不添加一个catchall它工作正常。

在使用虚拟别名之前,我已经定义了一个catchall

local_recipient_maps = luser_relay = catchall 

但是因为我需要从不同的域中分离邮件地址,所以我不得不使用虚拟别名。

现在postfix.org说我应该这样做,我做了:

/etc/postfix/main.cf文件:

 virtual_alias_domains = example.com virtual_alias_maps = hash:/etc/postfix/virtual 

/等/后缀/虚拟:

 [email protected] account1 [email protected] account1 [email protected] account2 @example.com catchall 

但是如果我这样做了,那么这个地址抓取所有的邮件,而不是邮件,而不是明确定义的地址。 为什么是这样的,如何改变它?

我没有postmap虚拟,也重新启动Postfix。 日志中没有错误,它只是将交付日志logging到catchall地址。 并且有一个警告“不要在mydestination和virtual_alias_domains中列出域example.com”,但我没有这样做! 我甚至没有一个mydestination指令。 (在下面的configuration中有一个,但是我在NickW之后build议如此。)

这是我完全的conf:

 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 /etc/dovecot/dovecot.conf -m "${EXTENSION}" mailbox_size_limit = 0 mydestination = $myhostname myhostname = mydomain.com mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 myorigin = /etc/mailname readme_directory = no recipient_delimiter = + relayhost = smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache smtp_use_tls = yes smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu) smtpd_recipient_restrictions = reject_unknown_sender_domain, reject_unknown_recipient_domain, reject_unauth_pipelining, permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination smtpd_sasl_auth_enable = yes smtpd_sasl_authenticated_header = yes smtpd_sasl_local_domain = $myhostname smtpd_sasl_path = private/dovecot-auth smtpd_sasl_security_options = noanonymous smtpd_sasl_type = dovecot smtpd_sender_restrictions = reject_unknown_sender_domain smtpd_tls_auth_only = yes smtpd_tls_cert_file = /etc/dovecot/dovecot.pem smtpd_tls_key_file = /etc/dovecot/private/dovecot.pem smtpd_tls_mandatory_ciphers = medium smtpd_tls_mandatory_protocols = SSLv3, TLSv1 smtpd_tls_received_header = yes smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache smtpd_use_tls = yes tls_random_source = dev:/dev/urandom virtual_alias_domains = $myhostname, myotherdomain.com virtual_alias_maps = hash:/etc/postfix/virtual 

如果你包含所有的电子邮件地址在虚拟别名,那么它将工作。

main.cf

  virtual_alias_maps = hash:/etc/postfix/virtual 

virtual

 [email protected] [email protected] [email protected] [email protected] ... [email protected] [email protected] @example.com [email protected] 

所以,我明白了。 有些人build议,所有人都必须在虚拟别名文件的顶部,但我曾尝试过,并没有帮助(虽然我发现解决scheme非常合乎逻辑)。

有效的是:

  1. 设置mydestination=localhost (不是$myhostname
  2. 在虚拟别名文件的顶部添加catchall: @domain.com catchall-account@localhost
  3. 添加下面的所有其他虚拟别名: [email protected] contact@localhost

该示例假定您有名为catchall-accountcontact UNIX用户。 发送给[email protected]的邮件将被发送给联系人用户,而所有其他邮件将被发送到全部账户。

也许这在所有情况下都是不必要的,但是在我的特殊情况下,我想使用一个帐户来保存一些地址的邮件,但是直接发送到那个帐户的邮件应该以一揽子方式结束。

毕竟,看起来像Postfix是不是从上到下通过虚拟别名的方式,另外catch-alls有一些特殊的优先级。 如果有人真的能够解释这种行为,我会很高兴进一步的评论。

尝试设置您的mydestination = $myhostname ,并确保您的主机名在main.cf中configuration,例如, myhostname = mail.example.com