阻止外发邮件给一些用户

我想阻止一些用户发送邮件到Exim4其他域。 我尝试了以下configuration,但没有工作。

exim.conf文件中完成的更改:

在主configuration部分,启用acl_smtp_mail控件,如下所示:

 acl_smtp_mail = acl_check_mail 

然后,在acl_check_rcpt ACLconfiguration部分创build一个新的规则:

 accept condition = ${lookup{$sender_address}lsearch{/etc/exim/freezelist_sender_addresses}{1}{0}} control = freeze/no_tell 

我试过这个,但没有工作。 请configuration我的意见。

你可以使用下面的acl

 acl_smtp_rcpt = acl_check_rcpt acl_check_rcpt: deny message = The $sender_address is prohibited to send mail to the $domain senders = lsearch;/etc/exim/restricted_sender domains = lsearch;/etc/exim/restricted_domains /etc/exim/restricted_sender [email protected] /etc/exim/restricted_domains gmail.com 

testing

 # swaks -s mail.example.net --to [email protected] --from [email protected] === Trying mail.example.net:25... === Connected to mail.example.net. <- 220 mail.example.net, [xxx.xxx.114.28] -> EHLO www.example.net <- 250-mail.example.net Hello www.example.net [xxx.xxx.114.28] <- 250-SIZE 52428800 <- 250-PIPELINING <- 250-STARTTLS <- 250 HELP -> MAIL FROM:<[email protected]> <- 250 OK -> RCPT TO:<[email protected]> <** 550 The [email protected] is prohobited to sent mail to the gmail.com -> QUIT <- 221 mail.example.net closing connection === Connection closed with remote host. 

最后的解决scheme一步一步来

  1. 创build文件restricted_sender。 例如:/ etc / restricted_sender
  2. 编辑exim.conf
  3. 在acl_smtp_rcpt的开头添加下一个规则:(或者如何调用它)

     deny condition = ${lookup{$sender_address}nwildlsearch{/path/to/the/restricted_sender} {yes}} domains = !+local_domains 

文件/path/to/the/restricted_sender包含每行一个电子邮件:

 [email protected] [email protected]