Skip to main content

How to change exim to relay from subdomain instead of hostname

Comments

10 comments

  • 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 = smtp.whm.mydomain.com

    And then make A record not proxied for smtp.whm.mydomain.com  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 = smtp.whm.mydomain.com

     

    And save file. Would that work?

     

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

    0
  • DevTeam9200

    I think I found the solution here:

     

    1. modify /etc/mailhelo

    smtp.whm.mydomain.com # 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 smtp.whm.mydomain.com via the hosting control panel as well. Will wait for propagation and do tests tomorrow. 

     

    1
  • 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.

    0
  • DevTeam9200

    hi Digital Pinacle thanks for the assistance. However as per https://docs.cpanel.net/whm/service-configuration/exim-configuration-manager/?_ga=2.2318130.38152556.1714346871-834511574.1711492903 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. 

     

     

     

    0
  • DevTeam9200

    hi I found the solution and resolves all issues.

    amend /etc/exim.conf 

    primary_hostname = smtp.whm.mydomain.com

     

    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 =

    0
  • 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: https://docs.cpanel.net/whm/service-configuration/exim-configuration-manager/

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

    0
  • DevTeam9200

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

    RE: You'll want to use the Exim Configuration Manager through WHM to ensure these changes stay permanent: https://docs.cpanel.net/whm/service-configuration/exim-configuration-manager/

    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.

    0
  • cPRex Jurassic Moderator

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

    https://support.cpanel.net/hc/en-us/community/posts/19149159993879-primary-hostname-and-unrouteable-address

    0
  • 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. 

     

    0
  • 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. 

    0

Please sign in to leave a comment.