Formats for /etc/mailhelo, mailips, etc.

I have to change how mail is sent from one of our machines because it is on a network with a poor reputation. I have additional ips and can switch the sending ip to something else.

When I look at the options in EXIM CONFIGURATION I see:

** Send HELO based on the domain name in /etc/mailhelo (*: HELONAME can be added to the file to change the default helo name) [?]
Send HELO based on the domain name in /etc/mailhelo (*: HELONAME can be added to the file to change the default helo name)

** Send outgoing mail from the ip that matches the domain name in /etc/mailips (*: IP can be added to the file to change the main outgoing interface) [?]
Send outgoing mail from the ip that matches the domain name in /etc/mailips (*: IP can be added to the file to change the main outgoing interface)

** Automaticlly send outgoing mail from the account's IP address instead of the main IP address. Warning: If you turn this setting on you should make sure reverse DNS entries match the ones in /etc/mail_reverse_dns. [?]
Automaticlly send outgoing mail from the account's IP address instead of the main IP address.

How do I change the info for these files, all of them are currently empty except for /etc/mail_reverse_dns which has the main server ip and machine name. Do I just edit it manually with VI or PICO and it will work or will it be blown away with the next "upcp" ?.

Staff Member

You may use any command-line text editor such as vi (or vim), nano (or pico), to edit the files. As long as the automatic option is not in use you can manually update and manage the mailhelo and mailips files without them being overwritten.

The easiest method to see a full version of the files with proper syntax is to temporarily enable the following "automatic" option:
WHM: Main >> Service Configuration >> Exim Configuration Editor >> Standard Options >> Domains and IPs
* Automatically send outgoing mail from the account's IP address instead of the main IP address. Warning: If you turn this setting on you should make sure reverse DNS entries match the ones in /etc/mail_reverse_dns

The above option will create the files so you can simply view their contents to see how they are used.

Alternatively, you can manually create them based off the following examples, while being sure to use your own domains and IP addresses where applicable; however, please note that to retain customizations of the two files, mailhelo and mailips, it is necessary to enable the relevant options via the Exim Configuration Editor in WHM as seen below.

WHM: Main >> Service Configuration >> Exim Configuration Editor >> Standard Options >> Domains and IPs
* Send HELO based on the domain name in /etc/mailhelo (*: HELONAME can be added to the file to change the default helo name)
* Send outgoing mail from the ip that matches the domain name in /etc/mailips (*: IP can be added to the file to change the main outgoing interface)

In mailips, the example entry that begins with an asterisk sets the default outbound (sending) IP address for domains without their own specific entry; you could, if desired, just have the default set and nothing else.

You should not have to manually edit or manage the mail_reverse_dns file; the only two that you would manually edit are mailhelo and mailips. For the sake of showing an example, though, here is what the mail_reverse_dns file might look like:

To help understand why the above examples look the way they do, in terms of why a particular domain has a specific HELO value and or why a particular domain has a specific outbound IP, and to help show what you might expect to see from the aforementioned "automatic" option, the following could be assumed:
1.) "domain2.tld" is a primary domain
2.) "sub.domain2.tld" is a sub-domain of "domain2.tld"
3.) "addondomain.tld" is an add-on domain of "domain2.tld"
4.) "other.domain3.tld" is a also primary domain
5.) "server1.domain1.tld" is the server hostname

If you opt to manually create, update and manage the mailhelo and mailips files, you are free to customize them as needed provided they contain the correct syntax and use only valid domains and IP addresses.

Staff Member

Why doesn't exim create the data for these files in the first place? Seems like the information already "exists" in the domain setups...

Click to expand...

The mailhelo and mailips files are only needed if you desire customization of HELO responses from Exim and to override the stock-default behavior of Exim using the main server IP address. If you opt to -not-use- the "automatic" option then you must manually create and manage the two (mailhelo and mailips) files. Conversely, if you opt to -use- the "automatic" option then cPanel will create and manage both files for you based upon the IP address of each account.

And to help me better understand the current behavior, when the files are empty, the information exim posts to a helo query when these are checked and the resultant error message is...

mail.domain1.com claims to be host server1.domain.com [but that host is at xx.xxx.xxx.52 (may be cached), not xx.xxx.xxx.94].

with the changes to the two files, then this type of message would be "fixed". right?

Click to expand...

The message alone usually does not indicate a fatal error, but whether or not the receiving mail server rejects an e-mail for that depends on how the recipient mail system is configured to handle the specific circumstances involved. Normally the warning is safe to ignore, and to the best of my knowledge it is usually only shown by online tools that check for possible DNS issues.

The message should only appear if an account is on an IP address different than your main server IP address, or more specifically, different than the default interface's IP address that you have Exim configured to use; however, as certain third-party mail server configurations might be more strict, to help ensure this scenario does not become a problem for you, or if you need to correct it, we have the functionality there for you to easily customize (Exim) as your needs require.

Staff Member

The HELO is still seen as the hostname, even though we have the domains listed in /etc/mailhelo

Click to expand...

If a bug is suspected please note that the best avenue to report it is via our ticket system, such as by using the link in the top-right corner of the forums, labeled Bugs; using this method helps to ensure greater efficiency, accuracy in diagnosis, full and in-depth investigation and faster resolution.