Exim ACL for blocking certain senders

This is definitely not spam

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 sudo 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:

[email protected]
[email protected]
*@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.