Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I want to block some users to sending out mails to other domains in Exim4. I tried the following configuration but did not work.

Changes done in exim.conf file:

In the main configuration section, enabled the acl_smtp_mail control as follows:

acl_smtp_mail = acl_check_mail

Then, in the acl_check_rcpt ACL configuration section, created a new rule:

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

I tried this but not worked. Please advice me with configuration.

share|improve this question

1 Answer 1

You can use the following 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
user@example.net

/etc/exim/restricted_domains
gmail.com

Testing

# swaks -s mail.example.net --to alex.hha@gmail.com --from user@example.net
=== 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:<user@example.net>
<-  250 OK
 -> RCPT TO:<alex.hha@gmail.com>
<** 550 The user@example.net is prohobited to sent mail to the gmail.com
 -> QUIT
<-  221 mail.example.net closing connection
=== Connection closed with remote host.
share|improve this answer
1  
I wish I could add another +1 for demonstrating using swaks, the best ever tool created for testing smtp connections, configuration, and seeing smtp conversation. Great comment! –  Todd Lyons Feb 21 at 15:07

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.