How to change Exim mail server IP address in cpanel server

Sometimes the mail which we sent being rejected by recipient (such as,, due to server IP blacklisted in SPAM database. Why its happen ? due to lack of monitoring. What we will do to prevent ? We need to monitor the server properly its mean if you got any relay alert or lots of mails in queue you should look into mail service and identify whether anybody SPAM from server or any open relay is there. If our IP address got blacklisted, first we need to check the server IP using this link.

If its blacklisted, You need to take further action to remove the IP address from blacklist. They don’t remove your IP immediately and it will take time. So mean while we can change our exim outbound IP address to solve our issue.

1) Add new IP address to server

Check on your server whether if you have additional IP. If so you can leave this step. If no you need to add new IP address (Make sure you should have additional free IP on your server. If no you should ask your Server provider to get additional IP) on your server to proceed further.

# Checking assigned IP address in server #
# ifconfig

# Adding new IP address into server #
# ifconfig eth0:1 xxx.xx.xx.xx netmask

2) Add new IP address to mailips file

Just open /etc/mailips file and add your new IP address with below format. So that all the domain Outbound mails take new IP address from your server.

# Adding new IP address to mailips file #
# nano /etc/mailips

3) Add new IP address to exim.conf file

Just open /etc/exim.conf file and find remote_smtp: then remove interface & helo_data line and add new interface like below.

# By default exim.conf file like below #
# nano /etc/exim.conf
  driver = smtp
  interface = ${if exists {/etc/mailips}{${lookup{$original_domain}lsearch{/etc/mailips}{$value}{${lookup{$sender_address_domain}lsearch{/etc/mailips}{$value}{${lookup{${perl{get_sender_from_uid}}}lsearch*{/etc/mailips}{$value}{}}}}}}}}
  helo_data = ${if exists {/etc/mailhelo}{${lookup{$original_domain}lsearch{/etc/mailhelo}{$value}{${lookup{$sender_address_domain}lsearch{/etc/mailhelo}{$value}{${lookup{${perl{get_sender_from_uid}}}lsearch*{/etc/mailhelo}{$value}{$primary_hostname}}}}}}}{$primary_hostname}}

# Make Change into exim.conf file #
# nano /etc/exim.conf
  driver = smtp
  interface = xxx.xx.xx.xx

4) Adding RDNS

Ask your Provider to create RDNS for your IP and assign the same to /etc/mail_reverse_dns file. Normally it will take 24-48 hours its purely depends upon your DNS provider. Add your RDNS with below format. So that all the domain Outbound mails will delivery properly or else some of the top provider reject your email due to RDNS. RDNS should be your server hostname.

# Adding RDNS entry #
# nano /etc/mail_reverse_dns

5) Changing file attribute

Use the below command to change files attribute, so that it wont get reset to default automatically.

# Making copy of exim.conf file #
# chattr +aui /etc/exim.conf

# Rebuilding exim.conf file #
# chattr +aui /etc/mailips

6) Restart exim

Use the below command to restart exim and send test mail then verify the header you can see new IP address.

# Restart exim service #
# service exim restart

Hope you are in SAFE.

About Magesh Maruthamuthu

Love to play with all Linux distribution

View all posts by Magesh Maruthamuthu

3 Comments on “How to change Exim mail server IP address in cpanel server”

  1. Thank you for some other magnificent post. The place else could anyone get that type of information in such an ideal method
    of writing? I have a presentation next week, and I’m at the search for such info.

  2. Excellent blog! Do you have any helpful hints for aspiring writers?
    I’m planning to start my own blog soon but I’m a little lost on everything.
    Would you suggest starting with a free platform like WordPress or go for a paid option? There are so many choices
    out there that I’m totally confused .. Any recommendations?
    Thank you!

Leave a Reply

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