Postfix 测试:我无法转发外发邮件

Postfix 测试:我无法转发外发邮件

我正在测试环境中配置 Postfix 服务器。它只能转发本地电子邮件。出站电子邮件必须重定向到 /dev/null 或本地帐户。我在您的论坛上找到了解决方案,但不幸的是它无法正常工作。我对 Postfix 不太熟悉。请帮助我。

/etc/postfix/main.cfg

compatibility_level = 2
queue_directory = /var/spool/postfix
command_directory = /usr/sbin
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
mail_owner = postfix
inet_interfaces = all
inet_protocols = all
myhostname = host.mail1.test
mydomain = mail1.test
myorigin = $mydomain
mydestination = $myhostname, localhost.$mydomain, $mydomain
mynetworks_style = subnet
relay_domains = [mail1.test]:587
smtpd_client_restrictions = permit_mynetworks
smtpd_helo_restrictions = permit_mynetworks
smtpd_sender_restrictions = permit_mynetworks
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject
smtpd_relay_restrictions = permit_mynetworks, permit_sasl_authenticated, reject
header_checks = regexp:/etc/postfix/header_checks
virtual_alias_maps = regexp:/etc/postfix/redirect

/etc/postfix/重定向

/.*@(?!hostname\.localdomain$).*/ mailtrap

/var/log/邮件日志

Jan  3 12:32:17 mail1-test postfix/trivial-rewrite[49647]: warning: regexp map /etc/postfix/redirect, line 1: Invalid preceding regular expression
Jan  3 12:32:17 mail1-test postfix/cleanup[49648]: warning: regexp map /etc/postfix/redirect, line 1: Invalid preceding regular expression

答案1

您尝试使用带有负向前瞻的正则表达式,(?!)regexp地图不支持该功能。您需要将其替换regexp:pcre:

相关内容