我想知道如何阻止我的用户互相发送邮件,但让他们有机会发送和接收外部邮件。
我已经尝试配置访问限制规则,例如
/etc/postfix/main.cf:
smtpd_recipient_restrictions =
...
check_recipient_access hash:/etc/postfix/protected_destinations
...the usual stuff...
smtpd_restriction_classes = insiders_only
insiders_only = check_sender_access hash:/etc/postfix/insiders, reject
/etc/postfix/protected_destinations:
[email protected] insiders_only
[email protected] insiders_only
/etc/postfix/insiders:
my.domain OK matches my.domain and subdomains
another.domain OK matches another.domain and subdomains
但这无济于事,因为本地发件人在检查本地收件人之前就被阻止,而本地收件人在检查外部收件人之前就被阻止。
答案1
上面的配置(显然来自这一页) 用于允许仅内部通信,并阻止从外部到内部的电子邮件。
对于你的情况,你需要修改它
# /etc/postfix/main.cf:
smtpd_recipient_restrictions =
...
check_recipient_access hash:/etc/postfix/protected_destinations
...the usual stuff...
smtpd_restriction_classes = reject_insiders
reject_insiders = check_sender_access hash:/etc/postfix/insiders, permit
# /etc/postfix/protected_destinations:
localdomain1.example.com reject_insiders
localdomain2.example.com reject_insiders
# /etc/postfix/insiders:
localdomain1.example.com REJECT local email isn't allowed
localdomain2.example.com REJECT local email isn't allowed