Changing the Sending IP for Outbound Email in Exim

You can manually specify from which IP addresses specific domains on your server should send mail with Exim. To do so, you will need to create and edit 2 files from the command line and disable one option in WHM’s Exim Configuration Editor interface.

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

  1. * Configuring Exim from WHM
  2. * Creating and Editing the Appropriate Files
    • o Editing /etc/mailhelo
      o Editing /etc/mailips


Configuring Exim from WHM

In order to specify which IP addresses should handle outbound mail, you will need to disable an option in WHM’s Exim Configuration Editor . You can find the Exim Configuration Editor in the Service Configuration section of WHM. To begin, navigate to the configuration editor and disable the following option:

    * Automatically send outgoing mail from the account’s IP address instead of the main IP address.

By default, Exim will send mail from the server’s main shared IP address. Enabling this option forces your users to send mail from their main domain’s IP address. If you choose to enable the option listed above, you will not be able to manually specify the IP addresses from which domains send mail.

Creating and Editing the Appropriate Files

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

  1. * /etc/mailhelo — Exim’s HELO command’s configuration file.
  2. * /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 this file, 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: 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: 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.

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

g33kadmin

I am a g33k, Linux blogger, developer, student and Tech Writer for Liquidweb.com/kb. My passion for all things tech drives my hunt for all the coolz. I often need a vacation after I get back from vacation....

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.