Why Change the Outgoing Email IP in Exim?

Sometimes, your server’s primary IP address gets blacklisted by spam monitoring services (RBLs), causing email deliverability issues.

If this happens, a quick solution is to route outgoing emails through a secondary IP that is not blacklisted. Exim, the default mail server in cPanel, allows you to configure a new IP for outgoing emails.

For a more detailed step-by-step guide, check out our updated tutorial:
Changing the Outgoing Email IP in cPanel/Exim.

Quick Steps to Change the Outgoing Email IP

Step 1: Stop the Exim Service

service exim stop
[OR]
/etc/init.d/exim stop

Step 2: Edit the Exim Configuration File

Open the Exim configuration file for editing:

vi /etc/exim.conf

Step 3: Modify the “remote_smtp” Section

Find the section under **TRANSPORTS CONFIGURATION** labeled remote_smtp.

By default, it looks like this:

remote_smtp:
  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_hostname}}

Step 4: Update the Outgoing IP Address

Remove or comment out the interface and helo_data lines, then replace them with your new IP address:

remote_smtp:
  driver = smtp
  interface = 12.12.12.12  # Replace with your new IP

Step 5: Save the Configuration and Set Read-Only Mode

To prevent cPanel from overwriting your changes, set the configuration file as read-only:

chattr +aui /etc/exim.conf

Step 6: Restart Exim

service exim restart
[OR]
/etc/init.d/exim restart

Step 7: Set Reverse DNS (PTR Record)

Ensure that the new IP address has a valid reverse DNS (PTR) record pointing to a Fully Qualified Domain Name (FQDN). This is required to avoid email rejection by receiving mail servers.

Step 8: Test and Verify

Send a test email and check the email headers to confirm that it is using the new IP address. You can also verify it in the Exim log:

tail -f /var/log/exim_mainlog

Get Expert Email Hosting with UnderHost

Having trouble with email deliverability? Upgrade to a Cloud VPS or Dedicated Server with advanced email routing options and full SMTP customization.

Need help? Contact UnderHost Support.