Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Change outbound domain for email with Exim

Discussion in 'E-mail Discussion' started by thealien, Mar 18, 2019.

  1. thealien

    thealien Member

    Joined:
    Apr 1, 2014
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    DataCenter Provider
    I was trying to diagnose an email delivery issue with emails going from a customers hosted domain to gmail.com where the mail was going to spam. From the same server but a different domain the same mail was going to inbox. Even though gmail postmaster tools said the reputation was high there must be something else triggering this.

    I used this post Forward certain domain emails to Smart Host to configure Exim to deliver this domain through AWS with the same result.

    My next thought was "what if" I could change the outbound email coming from @domain1.com to @domain2.com using Exim so that the users didn't have to change anything. Once Gmail started to deliver domain1.com into the inbox again I could remove this and add domain2.com as an alias domain.

    Can anyone give me some pointers on how to accomplish this using Exim ?

    Perhaps a modified version of Exim: Change sender address when sending mails out of local network which would work on a cpanel server with multiple accounts and domains.
     
  2. Volox

    Volox Member

    Joined:
    Jun 11, 2017
    Messages:
    18
    Likes Received:
    2
    Trophy Points:
    3
    Location:
    San Diego
    cPanel Access Level:
    Root Administrator
    Are the two domains you have on the server using the same IP? Or are they using a dedicated IP?

    Have you looked at the 'original message' raw format (menu item under the 3 dots in the upper right when viewing the message in gmail) to see if the email that is going to spam is failing DKIM or SPF ?
     
  3. thealien

    thealien Member

    Joined:
    Apr 1, 2014
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    DataCenter Provider
    I went through the headers in detail knowing how to read them. SPF/DKIM is good...passes on all counts.

    Issue is not IP based. It's definitely domain based.
     
  4. Volox

    Volox Member

    Joined:
    Jun 11, 2017
    Messages:
    18
    Likes Received:
    2
    Trophy Points:
    3
    Location:
    San Diego
    cPanel Access Level:
    Root Administrator
    Is it safe to assume you've checked the domain for being listed on any blacklists?

    Is the outbound helo name that is being used match the domain name of the sender? And does that server name have a valid SSL cert and is sending using TLS ?
     
  5. thealien

    thealien Member

    Joined:
    Apr 1, 2014
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    DataCenter Provider
    Yeah checked all the necessary. Emailed Gmail a bunch of times but they don't respond. At this point all I need to do is to try and use exim to re-write the outbound domain.

    Perhaps I can use the AWS relay config I used and just setup another domain in there, but I'm sure Exim can do it...I just don't know how without breaking things.
     
  6. Volox

    Volox Member

    Joined:
    Jun 11, 2017
    Messages:
    18
    Likes Received:
    2
    Trophy Points:
    3
    Location:
    San Diego
    cPanel Access Level:
    Root Administrator
    What domain are you going to re-write the outbound domain to?

    If all your headers look right and the delivery path is correct and spf and dkim is a pass, then maybe I'm missing where the problem is? I thought your problem was with getting the email to successfully deliver looking like it was coming from the domain of the sender; is that not the issue?
     
  7. thealien

    thealien Member

    Joined:
    Apr 1, 2014
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    DataCenter Provider
    I want to use Exim to rewrite the outbound domain of an email sent from this server.

    If I add a domain forward I want to write the primary domain to the domain forward when an email is sent.

    So if the domain of an email hosted on the server is @domain1.com I want to rewrite an outbound email when sent from @domain1.com to @domain2.com without the user having to do anything. This means I can change their outbound on the fly and since it’s a domain forward inbound will continue to work. Once I can get domain1.com out of the spam box I can remove the exim config and all continues to work.
     
  8. Volox

    Volox Member

    Joined:
    Jun 11, 2017
    Messages:
    18
    Likes Received:
    2
    Trophy Points:
    3
    Location:
    San Diego
    cPanel Access Level:
    Root Administrator
    I think what you would be looking for would be in the Exim Configuration -> Advanced Editor
    Look for the section titled -> Section: REWRITE

    I might be a little rusty on the pattern, but I think you're going to want something like:
    *@domain1.com $1@domain2.com Ffrs

    If you use subdomains, you might have to also have
    *@*.domain1.com $1@domain2.com Ffrs

    If anyone does silly things like putting an email address as bob@DOMAIN1.com, then you probably want to prefix the match string with ^(?i) so that it is case insensitive.

    The flags at the end tell the rewrite which headers to apply to, so adjust according to what you are trying to do. You might also find that you need to use flag S depending on whether you have other processing that needs the domain rewritten beforehand.

    Full docs are here: 31. Address rewriting

    Best way to check without hosing your users while testing is to start with a specific match that you can test and then move to the generic. For example:
    *test@domain1.com $1@domain2.com Ffrs
     
    cPanelMichael likes this.
  9. cPanelMichael

    cPanelMichael Technical Support Community Manager Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    47,005
    Likes Received:
    2,123
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice