Skip to main content

How to change exim to relay from subdomain instead of hostname



  • DevTeam9200

    to update this I believe I may have the answer but want to confirm if this is correct process and will not be overwritten in updates etc.

    I want to amend /etc/exim.conf 

    # primary_hostname = 

    Un remark the above and enter in 

    primary_hostname =

    And then make A record not proxied for  so it will reveal the correct IP ADdress in reverse lookup. 

    However as per here: it says you must use the Exim Advanced editior Exim Configuration Manager | cPanel & WHM Documentation and it will create /etc/exim.conf.local file. However I cannot see in the Advanced editor where it allows to amend "primary hostname" 

    Can I just make the /etc/exim.conf.local file with touch and then just add:

    primary_hostname =


    And save file. Would that work?


    Also thanks to Shane from Vultr for his support and assistance to date has been very helpful. 

  • DevTeam9200

    I think I found the solution here:


    1. modify /etc/mailhelo # added this to file and saved

    2. Then updated and amended Home / Service Configuration / Exim Configuration Manager

    Reference /etc/mailhelo for custom outgoing SMTP HELO [?]
    Send HELO based on the domain name in /etc/mailhelo

    I then turned this on. 

    And saved and restarted.  Pending for time to propagate and will test but any feedback from anyone would be appreciated.

    I also amended the PTR to be via the hosting control panel as well. Will wait for propagation and do tests tomorrow. 


  • Digital Pinacle

    To change Exim to relay from a subdomain instead of the hostname, you'll need to adjust the configuration settings in Exim. Here's a step-by-step guide:

    1. Open the Exim configuration file: Locate the Exim configuration file on your system. Typically, this file is named exim.conf or exim4.conf, and it's usually found in the /etc/exim directory.

    2. Find the router section: In the configuration file, search for the section that defines the routers. This section contains rules that determine how Exim routes messages.

    3. Modify the router settings: Look for the router responsible for handling outgoing mail, often named something like dnslookup, smarthost, or remote_smtp. Within this router definition, you'll find settings related to relaying.

    4. Update the relay configuration: Locate the setting that specifies the hostname used for relaying. This setting might be named smarthost, hosts_try_auth, or similar. Change the hostname specified here to your desired subdomain.

    5. Save the changes: After making the necessary adjustments, save the configuration file.

    6. Restart Exim: To apply the changes, restart the Exim service using the appropriate command for your operating system. This might be something like service exim restart or systemctl restart exim.

    7. Test the configuration: Send a test email from your system to ensure that Exim is relaying outgoing mail through the specified subdomain.

    By following these steps, you can configure Exim to relay outgoing mail through a subdomain instead of the hostname.

    And yes do remember to carefully review the changes to ensure they align with your requirements and existing configuration.

  • DevTeam9200

    hi Digital Pinacle thanks for the assistance. However as per They advise not to make changes to /etc/exim.conf as they will be lost on updates etc. Whilst the above most likely applies to exim on a standard linux server I believe exim on cPanel/WHM server is slightly different. I need to find out how to find the relevant action in WHM. 

    I will see if I can find the above solution to implement like for like in WHM. 




  • DevTeam9200

    hi I found the solution and resolves all issues.

    amend /etc/exim.conf 

    primary_hostname =


    This resolves all issues and WORKS perfectly and problem solved. ONLY issue I still now have is to ensure this is not lost after update and overwritten. Not sure how to ensure this change is "permanent"


    Any time make "any change to EXIM" config in WHM this is lost and reverts back to:


    split_spool_directory = yes

    smtp_connect_backlog = 50
    smtp_accept_max = 100

    # primary_hostname =

    # Specify the domain you want to be added to all unqualified addresses
    # here. An unqualified address is one that does not contain an "@" character
    # followed by a domain. For example, "caesar@rome.ex" is a fully qualified
    # address, but the string "caesar" (i.e. just a login name) is an unqualified
    # email address. Unqualified addresses are accepted only from local callers by
    # default. See the receiver_unqualified_{hosts,nets} options if you want
    # to permit unqualified addresses from remote sources. If this option is
    # not set, the primary_hostname value is used for qualification.

    # qualify_domain =

  • cPRex Jurassic Moderator

    Hey there!  It would be best to not include any public domain names or IP addresses in your post.

    You'll want to use the Exim Configuration Manager through WHM to ensure these changes stay permanent:

    You can likely use the Advanced Editor mode to accomplish your changes.

  • DevTeam9200

    cPRex thanks for response. I have edited all posts and changed to . Apologise on that. 

    RE: You'll want to use the Exim Configuration Manager through WHM to ensure these changes stay permanent:

    I did already cover this in my initial post and aware of this. However can you please advise where in the Advanced editor you can clearly change the "primary_hostname" for EXIM. It does not offer anything regarding the primary_hostname that I could see.

  • cPRex Jurassic Moderator

    What about the details mentioned here?  This information is all still valid:

  • DevTeam9200

    cPRex thanks for your reply. Can you please expand on this a little more still valid? It is from 4 years ago. I believe the way to resolve the issue is "amend" primary_hostname in exim. I have opened a ticket with cPanel support #95255429. They have advised this not possible at present and cannot be modified in the Advanced editor. See below from support team:

    "Thank you for your patience. I've filed an internal case with our developers to add the ability to modify the primary_hostname value through the Exim Configuration Editor -> Advanced Editor. The case ID is CPANEL-44124" 

    The link you provided above mentions changing the qualify_domain . I do not believe this will resolve the issue.

    The answer here is if anyone knows how to change /etc/exim.conf setting "primary_hostname" permanently. Ie so it is not lost after updates etc. Until a time it can be done via the Advanced Editor. 


  • cPRex Jurassic Moderator

    Thanks for sharing that - if we checked out your system and confirmed it's not possible, that would be the final word. 


Please sign in to leave a comment.