Block TLDs in Exim for DirectAdmin

In recent years many new TLDs have been added and they are often used to send spam. These are TLDs such as .stream and .lol. The chances of receiving a legitimate email from these types of addresses are almost nil. For that reason, you can choose to block these types of domains by default. This saves a lot of resources from your spam filter, but also irritation from spam mails that still get through the spam filter. Luckily it is very easy to block TLDs in Exim.

Step 1 – Block Spam TLDs

Open the following file:


Now put this list of wildcard domains (spam tlds) in it:


Of course, take a good look at the list and adjust it to your own liking. Do you know another extension that can be added to this list? Open a Pull Request on GitHub!

Step 2 – Restart services

Now restart Exim:

systemctl restart exim.service

Finished! Mails from those domains now get a reject back:

554 denied. 5.7.1 Domain Blocked due to SPAM

As you saw it’s very easy to block TLDs in Exim. This way you are never bothered again with annoying spam coming from these TLDs!

Step 3 – SpamAssassin improvements

Blocking TLDs only is not enough to block incoming spam emails. It’s also important to improve SpamAssassin preferences and settings. In this tutorial we will explain how you do this!