How to change the mail server IP for a blacklisted server(cPanel) -Exim

How to change the mail server IP for sending emails, if your server ip address is blacklisted in TOP-LEVEL email providers ?

Sometimes the emails that we have sent being rejected by top level email providers because of the server IP blacklisted. In this situation where we are not able to sent or our messages that we have already sent is reached to the spam folder of others, the first step is check your IP is in any Blacklist. Here is the link to check IP black list . If your server IP address is not in this listed blacklist then the issue related to any other not related to your server IP.

If it is in Blacklist, (I) You must to take necessary actions/steps to remove IP address from there. (II) Here we have an alternative method to use another IP address for your Mail server. Here I’m explaining how to use an alternative IP address for Mail servers in a WHM/cPanel based servers.

Step I:  Add new IP address to your server.

Via WHM : Home » IP Functions » Add a New IP Address

Step II: Add IP to Mail server

SSH to server
[root@server]# vi /etc/mailips (And add the new IP address as mentioned below: )

step III: Add a RDNS entry, It may help DC to find you

[root@server]# vi /etc/mail_reverse_dns HOSTNAME

Step IV: (Not necessary)
Change file attribute of /etc/mailips

[root@server]# chattr +i /etc/mailips
[root@server]# lsattr /etc/mailips
----i-------- /etc/mailips

Step V:
Final step; Re-build exim config file to reflect the changes then restart Exim service.

[root@server]# /scripts/buildeximconf
[root@server]# service exim restart

Then login to WHM panel and follow the steps pasted below for using our new IP address to send emails

Login to WHM (https:IPAddress:2087) >> Home >> Service Configuration >> Exim Configuration Manager >> In Basic editor section select Domain and IP's >> turn on "Reference /etc/mailips for outgoing SMTP connections" section >> SAVE

Please refer the attached image for more details.


That’s it 🙂


Related Links:
Quick way to remove all emails from the mail queue – Exim command line option
How to count emails in mail queue with mail senders’ name – Exim command
Check spamming on server having EXIM

Post navigation

Arunlal A

Senior System Developer at Zeta. Linux lover. Traveller. Let's connect! Whether you're a seasoned DevOps pro or just starting your journey, I'm always eager to engage with like-minded individuals. Follow my blog for regular updates, connect on social media, and let's embark on this DevOps adventure together! Happy coding and deploying!

One thought on “How to change the mail server IP for a blacklisted server(cPanel) -Exim

  1. Hello Arun, Great Post! Actually we have followed the accurate steps and IPs has been successfully changed but with Yahoo it is still showing the same error:
    Error: “421 4.7.0 [TS01] Messages from x.x.x.x temporarily deferred due to user complaints –” when sending email to Yahoo

    What can we do in this case?


Leave a Reply

Your email address will not be published. Required fields are marked *