If you're in a need for fast and simple solution to block certain senders directly on Exim mail server, you're in luck. Couple of weeks back I needed to blacklist a spammer on a relay mail server, so that I could take my time and carefully trace the origin server/script from where the spam was being sent.
Implementing sender blocklist is very simple. Just open Exim's configuration file - if you're using CentOS or RHEL, look no further than /etc/exim/exim.conf. On Debian based distributions Exim's configuration is split into multiple files, so the recommended way of reconfiguring Exim is with dpkg-reconfigure exim4-config.
So the whole ACL is pretty short, simple and self explanatory:
acl_check_data: deny senders = /etc/deny_senders accept
The chances are that you already have acl_check_data: defined in your exim.conf, so basically you'll just need to add the second line below it.
Afterwards, you can put senders you wish to block in /etc/deny_senders. You can either block specific e-mail address or whole domains. Here are some examples:
user@domain.tld user@sub.domain.tld *@spammer.tld *@lol.cats.tld
Note that after adding ACL you'll need to restart Exim, however editing deny_senders list doesn't require restart.
6 comments
TLD block
Submitted by Steve (not verified) on 25. November 2013 - 20:39Re: TLD block
Submitted by Sasa Tekovic on 25. November 2013 - 22:52I didn't test that, but you should be able to blacklist whole TLD. Feel free to try it and let me know how it goes
Yes, whole top level domains
Submitted by Leo Smith (not verified) on 6. September 2014 - 22:49some problem
Submitted by prabhat (not verified) on 8. May 2015 - 16:18exim block mail is and domain that sebd s email from my servers
Submitted by ajit (not verified) on 9. July 2015 - 9:06doesn't work on Debian
Submitted by gags (not verified) on 14. October 2016 - 1:53Add new comment