Enable Custom Exim Mail HELOs in cPanel – Easy Setup
This guide is designed to walk you through the process of Enable Custom Exim Mail HELOs in cPanel WHM. Exim is a mail transfer agent (MTA) commonly used on WHM/cPanel servers. Exim Mail HELOs play a crucial role in the initial handshake between a mail server and a client, identifying the sending server. By enabling custom Mail HELOs, you gain greater control over your server’s identity and improve email deliverability. Let’s delve into how to configure custom Mail HELOs within Exim.
The following steps, provided by Orcacore, will guide you through enabling custom Mail HELOs in cPanel.
To Enable Custom Exim Mail HELOs in cPanel, begin by logging into your WHM cPanel interface.
First, navigate to the Exim Configuration Manager:
**WHM >> Exim Configuration Manager**

Next, within the Exim Configuration Manager, go to the Basic Editor:
**Basic Editor >> Domains and IPs**

In the Domains and IPs section, disable the "Use the reverse DNS entry for the mail HELO/EHLO if available" option. Set it to off.
Then, enable the "Reference /etc/mailhelo
for custom outgoing SMTP HELO" option. Set it to on.
Your configuration should resemble the following:

Click Save to apply the changes.
Finally, create or edit the /etc/mailhelo
file using a text editor like vi
. Add the domains and their corresponding custom Mail HELOs to the file.
Here’s an example of a custom /etc/mailhelo
file:
example.com: example.com
sub.example.com: example.com
example.net: example.net
addon.example.net: example.net
*: hostname.example.com
The domain and its custom Mail HELO are defined as pairs. The line *: hostname.example.com
specifies the default Mail HELO for domains not explicitly listed in the file.
That’s it! You have successfully learned how to Enable Custom Exim Mail HELOs in cPanel.
For more information about Exim, refer to the Exim Documentation.
Conclusion
You’ve now learned how to Enable Custom Exim Mail HELOs in cPanel using this guide and created a custom /etc/mailhelo
file.
You may also find these articles helpful:
Alternative Solutions to Enable Custom Exim Mail HELOs
While the /etc/mailhelo
method is a straightforward approach, here are two alternative methods to achieve the same goal of customizing Exim Mail HELOs in cPanel:
1. Using the Advanced Exim Configuration Editor
This method involves directly modifying the Exim configuration file using WHM’s Advanced Editor. This provides more granular control but requires a deeper understanding of Exim’s configuration syntax.
Explanation:
Exim’s configuration is highly flexible, allowing you to define HELO strings based on various conditions, such as the sending domain, IP address, or authenticated user. By directly editing the Exim configuration, you can implement more complex HELO assignment rules than the simple /etc/mailhelo
method allows.
Steps:
-
Access the Advanced Editor: In WHM, navigate to
Exim Configuration Manager -> Advanced Editor
. -
Locate the
helo_data
variable: Search for the section defining thehelo_data
variable. This variable typically determines the HELO string used by Exim. -
Modify the
helo_data
variable: You’ll need to add conditional logic to thehelo_data
definition to assign different HELOs based on the sending domain. This usually involves using Exim’s string expansion and conditional operators.
Code Example (Illustrative):
helo_data = ${if def:sender_address_domain {
${lookup{$sender_address_domain}lsearch{/etc/mailhelo}{$value}{$primary_hostname}}
} { $primary_hostname } }
Explanation of the Code:
${if def:sender_address_domain { ... } { $primary_hostname }}
: This is a conditional statement. If thesender_address_domain
variable (the domain of the sender address) is defined, the code within the first set of curly braces is executed. Otherwise, the server’s primary hostname ($primary_hostname
) is used as the HELO.${lookup{$sender_address_domain}lsearch{/etc/mailhelo}{$value}{$primary_hostname}}
: This performs a lookup in the/etc/mailhelo
file using thesender_address_domain
as the key.lsearch
: Specifies a line-by-line search.{$value}
: If a match is found in/etc/mailhelo
, the corresponding value (the custom HELO string) is used.{$primary_hostname}
: If no match is found, the server’s primary hostname is used.
Important Considerations:
- Backup your configuration: Before making any changes to the Advanced Editor, always back up your current Exim configuration.
- Syntax Errors: Incorrect syntax in the Exim configuration can prevent Exim from starting. Be extremely careful when editing the configuration.
- Testing: After making changes, thoroughly test your email sending to ensure the correct HELOs are being used.
2. Using a Custom Exim Filter
Exim allows you to create custom filters that can modify email messages as they are being processed. You can leverage this to modify the HELO string based on custom criteria. This approach is more complex but offers the most flexibility.
Explanation:
Exim filters operate on email messages as they pass through the system. You can define rules within the filter to modify various aspects of the message, including the HELO string used during the SMTP handshake. This allows for very granular control and the ability to implement complex HELO assignment logic.
Steps:
-
Create a custom Exim filter file: Create a new file in the
/etc/exim4/conf.d/acl
directory (or the equivalent location for your Exim configuration) to store your custom filter rules. Give it a descriptive name, such asacl_check_helo_custom
. -
Define the filter rules: Within the filter file, define the rules that will determine how the HELO string is modified. This will typically involve checking the sending domain and setting the
helo_data
variable accordingly. -
Configure Exim to use the filter: Modify your Exim configuration to include your custom filter file. This usually involves adding an
acl
directive in the appropriate section of the Exim configuration.
Code Example (Illustrative):
# /etc/exim4/conf.d/acl/acl_check_helo_custom
check_helo:
accept
domains = +local_domains
condition = ${if match{$sender_address_domain}{example.com}{yes}{no}}
set helo_data = custom.example.com
accept
domains = +local_domains
condition = ${if match{$sender_address_domain}{example.net}{yes}{no}}
set helo_data = custom.example.net
accept
domains = +local_domains
set helo_data = $primary_hostname
Explanation of the Code:
check_helo:
: This defines a new access control list (ACL) section for checking the HELO.accept
: Indicates that if the conditions are met, the HELO is accepted and the actions are performed.domains = +local_domains
: This ensures the filter only applies to emails originating from domains hosted on your server.+local_domains
is a predefined Exim list containing the server’s local domains.condition = ${if match{$sender_address_domain}{example.com}{yes}{no}}
: This checks if the sending domain matchesexample.com
. If it does, the condition is true (yes
). Otherwise, it’s false (no
).set helo_data = custom.example.com
: If the condition is true, thehelo_data
variable is set tocustom.example.com
.- The subsequent
accept
block repeats the process forexample.net
. - The final
accept
block acts as a default, setting thehelo_data
to the server’s$primary_hostname
if none of the previous conditions are met.
Important Considerations:
- Exim Filter Syntax: Exim filter syntax can be complex. Refer to the Exim documentation for detailed information.
- Filter Order: The order in which filters are applied is important. Ensure your custom filter is placed in the correct position in the Exim configuration.
- Security: Be cautious when using filters, as they can potentially introduce security vulnerabilities if not implemented correctly.
These alternative methods offer more flexibility and control over HELO assignment compared to the /etc/mailhelo
approach. However, they also require a deeper understanding of Exim’s configuration and filter capabilities. Choose the method that best suits your needs and technical expertise. Remember to always back up your configuration before making any changes and thoroughly test your email sending after implementation. Understanding how to Enable Custom Exim Mail HELOs in cPanel allows for improved email deliverability. Finally, remember to thoroughly test any changes you make.