在 Postfix 中阻止仅向 Yahoo 和 Gmail 域发送邮件

在 Postfix 中阻止仅向 Yahoo 和 Gmail 域发送邮件

我想阻止从我的邮件服务器向 yahoo 或 gmail 发送邮件,但我想继续接收来自 yahoo/gmail 的邮件。我正在使用 ubuntu 10.04 LTS、带有 mysql 虚拟邮箱的 postifx 邮件服务器。

答案1

你需要与 合作transport_maps。所以投入main.cf

transport_maps = hash:/etc/postfix/transport

然后/etc/postfix/transport输入

gmail.com     error:You are not allowed to contact Google
googlemail.com     error:You are not allowed to contact Google
yahoo.com     error:You are not allowed to contact Yahoo

之后别忘记postmap /etc/postfix/transport

请注意,这只会拒绝提到的域名。根本不会拒绝 MX 记录。Yahoo 和 Google 有很多替代域名需要您处理。因此,最好对它们的 MX 服务器设置防火墙。另一方面,这会拒绝所有发往托管在 Google Apps 或 Google for Business 上的域的邮件。

答案2

尝试后缀限制类,我相信这就是你所需要的。参考:http://www.postfix.org/RESTRICTION_CLASS_README.html#internal

相关内容