How to change Exim mail server IP address in cpanel server

Sometimes the mail which we sent being rejected by recipient (such as outlook.com, hotmail.com, Yandex.com, google.com, yahoo.com, domain.com..etc..) 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 mail server outbound IP address to solve our issue.

Add new IP address to server

Check on your server whether if you have additional IP, dont have Additional IP’s please submit order for additional IP’s here. 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 255.255.255.0

Add new IP address to mail IP’s 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
*:xxx.xx.xx.xx

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
remote_smtp:
  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
remote_smtp:
  driver = smtp
  interface = xxx.xx.xx.xx

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
xxx.xx.xx.xx: server.domain.com

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

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 All done and SAFE. If you need more assistant please contact support team [email protected]

Leave a Reply

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