Changing the Sending IP for Outbound Email in Exim

For WHM version 11.38

note Note: You will need to have root privileges on the server to configure Exim in this way.

By default, Exim will send mail from the server's primary IP address. There is also an option in the Basic Exim Configuration Editor to send mail from IP addresses delegated to accounts with dedicated IPs.

note Note: These instructions are not needed for either of those two scenarios. These instructions are only needed if you wish to manage the outgoing IP addresses manually. To do so, you will need to create and edit 2 files from the command line and properly set 3 options in WHM's Exim Configuration Editor interface.

Configuring Exim from WHM

In order to specify which IP address should handle outbound mail, you will need to properly set the following options in WHM's Exim Configuration Manager.

Column Description
Send mail from account’s dedicated IP address Disable this option to manually manage the files. If this option is selected, /usr/local/cpanel/scripts/updateuserdomains will be used to automatically populate /etc/mailhelo and /etc/mailips, overriding your changes.
Reference /etc/mailhelo for outgoing SMTP HELO Enable this option to ensure that Exim matches the proper HELO to each outgoing IP address.
Reference /etc/mailips for outgoing SMTP connections Enable this option so Exim will use /etc/mailips to set the outgoing IP address when sending mail.

Creating and Editing the Appropriate Files

In order to specify IP addresses, you will need to create and edit 2 files from the command line. The files are:

  • /etc/mailheloExim's HELO command's configuration file.
  • /etc/mailips — The file that specifies from which IP addresses mail should be sent.

Editing /etc/mailhelo

Exim uses the HELO command to initiate dialog between a mail server and a client. This file governs which domain should send the HELO command. To create the file /etc/mailhelo, you will need to use a text editor such as nano, vi, or vim. Once you have created and opened the file for edit, you will need to configure it in the following way:

example.com: example.com
sub.example.com: example.com
example.net: example.net
addon.example.net: example.net
*: hostname.example.com

note Note: In the example above, the asterisk (*) entry will be used to direct outbound mail for domains without entries within this file. The domain in this context should be your server's hostname.

Be sure to use only valid domain names that are publicly accessible via the Internet.

Editing /etc/mailips

This file controls the IP address from which each domain should send mail. You will, as in the example above, need to create and open the /etc/mailips file for editing using your preferred text editor. You will need to configure this file in the following way:

example.com: 192.168.0.2
sub.example.com: 192.168.0.2
example.net: 192.168.0.3
addon.example.net: 192.168.0.3
*: 192.168.0.1

note Note: In the example above, the asterisk (*) entry will be used to direct outbound mail for domains without entries within this file. In this case, this should be your server's main shared IP address. You can set it to another IP address if you ensure that the asterisk entry in /etc/mailhelo has the corresponding domain name.

Be sure to use only valid IP addresses that are publicly accessible via the Internet.

Topic revision: r15 - 25 Jan 2013 - 16:01:08 - Main.LaurenceSimon
AllDocumentation/WHMDocs.EximDifferentIps moved from Sandbox.EximDifferentIps on 15 Sep 2009 - 19:23 by Main.JustinSchaefer - put it back