One of the biggest problems of the administrators of e-mail servers, is the spam. Especially from areas that send messages from countries such as Russia and China. In this tutorial you will see how you block an email in EXIM, for receiving e-mail messages.
To filter the IPs is quite difficult, especially if these are several thousand and are not included in a Spam Globala list. I saw how many messages come from qq.com. A domain address that uses a lot of IPs and which makes spam globally.
If we identify the source domain from which these messages are sent and we have access to the service configurations EXIM, can be set an automatic rejection of them. This means that the messages sent from a specific domain name or from an e-mail address can be rejected automatically. Basically, in this way you block a field of email in EXIM, manually, if you do not have a software installed on the server to do so.
How do you block an Email Inf (Incoming Mail)
To set EXIM automatically reject the messages received from one or more names of domains, e-mail addresses or even TLDs (.cn, .in, .io, etc…), first of all you have to have full access to the e-mail server and make sure that the transport of e-mail is done through the EXIM service.

Besides, EXIM This is the most used globally on Linux servers.
1. Localize and open a text editor for Linux, the file “exim.conf“. The name may vary depending on the version of EXIM used.
nano /etc/exim.conf
2. In exim.conf add the following lines for ACL (Access Control Lists).
acl_check_data:
deny senders = /etc/deny_senders
accept
Save the file after adding the above lines.
3. Create a new file, called: “deny_senders” in which you add the areas, e-mail addresses or .TLDs from which you no longer want to receive email messages:
nano /etc/deny_senders
Add the areas from which email messages are automatically rejected.
*@qq.com
*.cn
[email protected]
4. Save the file and restart Exim.
systemctl restart exim
This is a very simple method by which you block an EXIM (INCOMING MAIL).
The result in the server will look like this:
tail -f /var/log/exim.log
1eYSPn-0006oJ-2U H=(qq.com) [180.117.215.50] F=<[email protected]> rejected after DATA
1eYSQJ-0006ok-FN H=(aplongsheng.com) [113.117.106.33] F=<[email protected]> rejected after DATA
1eYSQU-0006pT-F6 H=(cdadsj.com) [118.248.236.18] F=<[email protected]> rejected after DATA
1eYSSQ-0006ux-QB H=(qq.com) [125.125.211.88] F=<[email protected]> rejected after DATA
It is the simplest option if you are taken up by the waves of spam from China, India, Russia or other areas of the globe. However, before you block a domain name or a TLD, make sure you have no partners or collaborators who could contact you from these addresses.
This setup of Exim is valid for the web servers with cPanel as well as for those with VestaCP.