Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

You can use the following acl

acl_smtp_rcpt = acl_check_rcpt


     message = The $sender_address is prohibited to send mail to the $domain
     senders = lsearch;/etc/exim/restricted_sender
     domains = lsearch;/etc/exim/restricted_domains




# swaks -s --to --from
=== Trying
=== Connected to
<-  220, []
 -> EHLO
<- Hello []
<-  250-SIZE 52428800
<-  250-STARTTLS
<-  250 HELP
 -> MAIL FROM:<>
<-  250 OK
 -> RCPT TO:<>
<** 550 The is prohobited to sent mail to the
 -> QUIT
<-  221 closing connection
=== Connection closed with remote host.
share|improve this answer
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 '14 at 15:07

The final Solution step by step

  1. Create file restricted_sender. Example: /etc/restricted_sender
  2. Edit exim.conf
  3. Add the next rule at the beginning of acl_smtp_rcpt: (or how you have called it)

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

File /path/to/the/restricted_sender contain emails one per line:
share|improve this answer

Your Answer


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.