Blog

cPanel: How to send mails through domain IP

Tags: cPaneleximmail server

Published on: September 9, 2014 by George K.

cPanel: How to send mails through domain IP

Scenario:

By default, Exim will send mail from the server’s main shared IP address. Which means that all clients on one server are sending out email through one IP? Sometimes you need to change mail server IP, Let us see how to do this,

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

WHM -> Service Configuration – >  Exim Configuration Editor

Automatically send outgoing mail from the account’s IP address instead of the main 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 mentioned above, you will not be able to manually specify the IP addresses from which the domains send mail. 

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

/etc/mailhelo —  Exim’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 dialogue between a mail server and a client. This file governs which domain should send the HELO command. Once you have created and opened the file for edit, you will need to configure it in the following way:

domain1.com: domain1.com
domain2.com: domain2.com
*: server1.mynetworks.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 format. Please note that the values given here are dummy ones and you need to replace them with the actual ones

domain1.com : 192.168.1.1
domain2.com : 192.168.1.12
* : 192.168.1.24

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. 

Restart the mail server

How to check it ?

Once the mail server is up, create a test email id on the domain and send a mail to the testing gmail id. Once the mail reaches the inbox, check the header and confirm that the IP is changed to the changed one.

mail1

Category : cPanel, Howtos, Troubleshooting

George K.

George K.

George started his career in web hosting and Linux technical support in the year 2004 and is with SupportSages since 2009. He has keen interest in server optimizations, custom security solutions, hacked server recovery, cyber forensic and high availability fail over system design and implementation. George loves long drives and is passionate about art and literature.

You may also read:

Comments

Add new commentSIGN IN

Let's Connect

Get new updates

Categories

$0.000 items