如何在 Postfix 中阻止电子邮件地址?

Pab*_*blo 6 postfix

我需要阻止 postfix 中的外部电子邮件地址向我发送电子邮件。这是我无法控制的第三方域名的外部电子邮件地址。

我需要阻止它的原因是因为他们配置错误,我收到一条消息,说“警告,您的消息尚未发送”,每隔一秒左右。我已经联系了他们的技术支持,但他们花了很长时间来修复它,与此同时,我的服务器和我的用户正在受苦。

我试过这样做。在我的 mail.cf 中,我添加了:

smtpd_sender_restrictions = check_sender_access hash:/etc/postfix/sender_access, permit
Run Code Online (Sandbox Code Playgroud)

在 /etc/postfix/sender_access 中,我添加了:

mailfilter@iomart.com REJECT
Run Code Online (Sandbox Code Playgroud)

我跑

postmap hash:sender_access
Run Code Online (Sandbox Code Playgroud)

并重新启动postfix,但似乎没有效果。

我也试过:

smtpd_recipient_restrictions = check_sender_access hash:/etc/postfix/sender_access
Run Code Online (Sandbox Code Playgroud)

在 main.cf 中,失败并出现此错误:

postfix/smtpd[2144]: fatal: parameter "smtpd_recipient_restrictions": specify at least one working instance of: check_relay_domains, reject_unauth_destination, reject, defer or defer_if_permit
Run Code Online (Sandbox Code Playgroud)

试:

smtpd_recipient_restrictions = check_sender_access hash:/etc/postfix/sender_access, permit
Run Code Online (Sandbox Code Playgroud)

给了我同样的错误。

Lau*_*scu 3

check_sender_access应该在之后reject_unauth_destination,否则你可能会成为开放中继。

smtpd_recipient_restrictions = reject_unauth_destination, check_sender_access hash:/etc/postfix/sender_access
Run Code Online (Sandbox Code Playgroud)

请参阅:http ://www.postfix.org/postconf.5.html#smtpd_recipient_restrictions

重要信息: smtpd_relay_restrictions 或 smtpd_recipient_restrictions 参数必须至少指定以下限制之一。否则Postfix将拒绝接收邮件:

拒绝,reject_unauth_destination

推迟、defer_if_permit、defer_unauth_destination

另一方面,使用smtpd_sender_restrictions应该可以,因此您可能在它之前有其他东西可以接受电子邮件。