How to change mail IP address on a cPanel WHM Server

How to change mail IP address on a cPanel WHM Server

My server IP address was blocked in few spam databases due to spamming (outgoing spam) from one the website on the server. My Server IP address was listed in barracuda, backscatterer, sorbs and in many other spam database websites.
I have submitted a delist request in all spam databases but usually it might take 24 – 48 hours to delist the server IP address from the spam databases. In some databases it will take only few minutes to remove your IP address from their blacklist. There are some spam database websites that will remove your IP address from their blacklist only if your server is no longer a source of spam. They will watch your server IP address for few days and will delist only when they confirm the spamming is fixed.

Outgoing emails will get rejected by ISPs if you’re on blacklist so you won’t be able to send emails till your IP is delisted. As a temporary fix you can change the mail IP address of your server so that your outgoing emails will not be affected. You can switch mail IP address to old one after your IP address is delisted in spam databases.

Before change the mail IP address you must fix the spamming on the server. New mail IP address will be blacklisted if the spam source is not fixed.

Do the below steps to change mail IP address of your cPanel Server. You must have server root access to change the mail IP address.

1. Log into server via SSH as ‘root’ user

Use software like “putty” to log in to your linux server.

2. Take a backup of the original /etc/mailips file

Command to backup : cp -a /etc/mailips /etc/mailips.backup

“cp” command will take a backup of the original mailips file.

3. Check the file /etc/ipaddrpool for free IP addresses on your server

Command : cat /etc/ipaddrpool


Log in to WHM and click on “Show IP Address Usage” to list all IP addresses on the server.

Home » IP Functions » Show IP Address Usage

4. Edit /etc/mailips using vi editor and add the below line


xxx.xx.xx.xx should be replaced with free IP address on your server

Example :


Here “” is the new mail IP address of the server.

Save and exit the /etc/mailips file by typing “:wq!” (without the quotes) in vi editor.

After doing the above steps you should login to WHM.

1. Log in to WHM (Webhost Manager)

URL to access WHM : https://YourServerIP:2087
username : root
Password : Enter WHM password

2. Search for “Exim Configuration Manager” in WHM search bar
Exim configuration manager mailips

3. Click on “Exim Configuration Manager” under “Service Configuration”

Home » Service Configuration » Exim Configuration Manager

4. Click on “Domains and IPs” tab in “Exim Configuration Manager”
change mail IP exim
5. Change “Reference /etc/mailips for outgoing SMTP connections” to “On”

On cPanel servers, by default “Reference /etc/mailips for outgoing SMTP connections” setting will be Off.
Change exim mailips
6. Click on “Save” to save the changes you have made in exim.conf
Exim mail IP address updated
Go the server backend (Command line) and restart exim service.

Command to restart exim service

command : /scripts/restartsrv_exim


/etc/init.d/exim restart (Command on CentOS 6 and RHEL 6 servers)


service exim restart
Restart exim service

You can also restart exim service from WHM. You can see option to restart exim under “Restart Services”.

Home » Restart Services » Mail Server (Exim)
restart exim service cpanel
Try sending a test email from the domain and check the email logs to make sure it is sent from new mail IP address.
Send a test email to gmail, aol, hotmail, yahoo etc to make sure it is sent and received without any issues.