Changing mail server ip in cpanel

There are 2 way to change ips in cpanle for mail server.


Login to cpanel and go to Exim configuration editor

Check the box next to

“Send outgoing mail from the ip that matches the domain name in /etc/mailips (*: IP can be added to the file to change the main outgoing interface)”

Save Changes

Then edit the file /etc/mailips

vi /etc/mailips

from shell and add:

*: ReplacewithnewIP

Restart exim

service exim restart


Login to Shell

Access the Exim configuration file:

vi /etc/exim.conf

Locate remote_smtp

The default setup will look like:

driver = smtp
interface = ${if exists {/etc/mailips}{${lookup{$sender_address_domain}lsearch{/etc/mailips}{$value}{}}}{}}
helo_data = ${if exists {/etc/mailhelo}{${lookup{$sender_address_domain}lsearch{/etc/mailhelo}{$value}{$primary_hostname}}}{$primary_ho stname}}

Change to:

driver = smtp
#interface = ${if exists {/etc/mailips}{${lookup{$sender_address_domain}lsearch{/etc/mailips}{$value}{}}}{}}
#helo_data = ${if exists {/etc/mailhelo}{${lookup{$sender_address_domain}lsearch{/etc/mailhelo}{$value}{$primary_hostname}}}{$primary_ho stname}}
interface = # Change to your server IP address.

Save changes and exit.

Restart Exim

service exim restart

Cpanel may overwrite these changes during an upgrade. This method is normally for a temporary change until you resolve issues with blacklists, etc. on the main IP.

Please follow and like us:
About shk

shk is a DevOps engineer with more than 12 years of experience in different organizations. He enthusiastic about learning new technologies and shares his knowledge through his blogs.


  1. I’m unsure if I agree with everything posted but this was definitely informative and well-written.

Comment Policy:

Your words are your own, so be nice and helpful if you can. Please, only use your real name, not your business name or keywords. Using business name or keywords instead of your real name will lead to the comment being deleted. Anonymous commenting is not allowed either. Limit the amount of links submitted in your comment. We accept clean XHTML in comments, but don't overdo it please.

Tell us what you're thinking...

All comments are moderated.

* Denotes required field.



Previous Post:
Next Post: