我想configurationpostfix只发送邮件到白名单中的地址。 我曾尝试在main.cf使用smtpd_recipient_restrictions ,如下所示:
smtpd_recipient_restrictions = reject_unauth_destination check_recipient_access hash:/path/to/whitelist
白名单文件是格式
[email protected] OK [email protected] OK
然后用postmap命令翻译成哈希。
不过,中继正在发送邮件到非白名单地址。 我错过了什么?
编辑:我通过sendmail命令,这显然是绕过smptd限制发送这封邮件。 有没有办法处理这个?
编辑2 /故事的其余部分:我花了相当多的时间尝试通过SMTP发送sendmail,以发现我使用的命令不是sendmail,但是后缀的sendmail兼容性接口模仿function,但不能告诉尽可能使用SMTP。
84104的解决scheme虽然完美。
你告诉后缀拒绝某些types的邮件,并接受其他邮件。 可能有些消息没有被捕获,或者在这种情况下它们被允许。 我想你想告诉它只接受(检查)列表并拒绝其他所有。
smtpd_recipient_restrictions = check_recipient_access hash:/path/to/whitelist reject
回复编辑:
sendmail(1)使用postdrop(1)而不是smtpd(8)实现类似你想要的东西的一种方法是操纵transport(5)的行为。
main.cf transport_maps = hash:/etc/postfix/transport transport [email protected] : [email protected] : [email protected] : * error: Recipient not whitelisted.
注意:如果您没有在发送地图中包含发件人的地址,它将无法收到退回邮件。