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!

Configure EXIM to handle all forwards locally

Discussion in 'E-mail Discussion' started by PeteS, Mar 22, 2018.

  1. PeteS

    PeteS Well-Known Member

    Joined:
    Jun 8, 2017
    Messages:
    123
    Likes Received:
    18
    Trophy Points:
    18
    Location:
    Oregon
    cPanel Access Level:
    Root Administrator
    To use AWS SES as SMTP for all non-local mail I have this configured in the PREROUTERS section of the EXIM config file:

    send_via_ses:
    driver = manualroute
    domains = ! +local_domains
    transport = ses_smtp
    route_list = * email-smtp.us-west-2.amazonaws.com;

    I would like to also restrict it from sending forwards set up in accounts on the server to SES. So in the same way that domains = ! +local_domains prevents local mail from routing to SES, I need a conditional statement that would also prevent all forwards from being sent through SES. But I can't find an answer anywhere-probably because I don't know what I'm looking for.

    Any help would be appreciated. Thanks.
     
  2. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    44,802
    Likes Received:
    1,896
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hi Pete,

    The Exim user's mailing list is often a good resource for these types of custom Exim configuration settings:

    Exim-users Info Page

    Also, while not exactly related to what you want to setup, there are some useful overall examples of smarthost configurations you may find helpful at:

    Forward certain domain emails to Smart Host

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. PeteS

    PeteS Well-Known Member

    Joined:
    Jun 8, 2017
    Messages:
    123
    Likes Received:
    18
    Trophy Points:
    18
    Location:
    Oregon
    cPanel Access Level:
    Root Administrator
    Thanks. I have a thread at the EXIM mailing list as well, but so far no response the concept of blocking forwards from a smarthost router.

    Hoping for something here - I can't imagine I'm the first to want to handle forwards separately. (I'll post a solution here if I find one elsewhere.)
     
    mamoo108 likes this.
  4. mamoo108

    mamoo108 Registered

    Joined:
    Apr 28, 2018
    Messages:
    2
    Likes Received:
    2
    Trophy Points:
    3
    Location:
    Australia
    cPanel Access Level:
    Root Administrator
    Did you end up finding a solid solution for this? I think I have the same setup. It's a shame ses can't forward the emails for us. You can do this manually each time like this:

    send_via_ses:
    driver = manualroute
    domains = ! +local_domains
    condition = ${if !eqi{$local_part@$domain}{EMAILADDRESS}}
    condition = ${if !eqi{$local_part@$domain}{EMAILADDRESS2}}
    transport = ses_smtp
    self = send
    route_list = * localhost

    Where EMAILADDRESS is the email you are forwarding to (your gmail)

    Can someone please post here if you find a dynamic way to do this.
     
  5. PeteS

    PeteS Well-Known Member

    Joined:
    Jun 8, 2017
    Messages:
    123
    Likes Received:
    18
    Trophy Points:
    18
    Location:
    Oregon
    cPanel Access Level:
    Root Administrator
    Thanks for bumping me. I have a solution that appears to work but I got bogged down with other things and didn't test it extensively yet. Here's the link to the relevant part of the EXIM list thread, and what I have so far...

    Re: [exim] How to rewrite From: header of offsite forwards only to prevent Amazon SES 554 error

    To use AWS SES, you must add domain specific DNS records for ALL domains on server that will send email (Integrating Amazon SES with Exim - Amazon Simple Email Service). The problem is that forwards from off server senders fail (are rejected by AWS SES). Then in the prerouters section I use this, and it appears to do what I want:

    PREROUTERS
    send_via_ses:
    driver = manualroute
    domains = ! +local_domains
    condition = ${if match_domain{$sender_address_domain}{+local_domains}}
    transport = ses_smtp
    route_list = * email-smtp.us-west-2.amazonaws.com;

    Domain = sends local recipient mail to the local router that follows this one.

    Condition = sends mail from a non-local sender (only the case when a non-local sender sends to an alias) to the local router that follows this one.

    So only outgoing mail from a local sender to a non-local recipient goes to SES.

    I would be interested in how this works for others.
     
    #5 PeteS, Apr 29, 2018
    Last edited by a moderator: Jul 25, 2018
  6. mamoo108

    mamoo108 Registered

    Joined:
    Apr 28, 2018
    Messages:
    2
    Likes Received:
    2
    Trophy Points:
    3
    Location:
    Australia
    cPanel Access Level:
    Root Administrator
    Awesome! That looks like it's working perfectly. Thanks so much for posting that. Will let you know here if I find any caveats with it.

    :)
     
    cPanelMichael and PeteS like this.
  7. andryangouw

    andryangouw Member

    Joined:
    Jun 26, 2010
    Messages:
    14
    Likes Received:
    2
    Trophy Points:
    51
    Thanks, I was looking for a similar case where smarthost needs to be ignored for valiases or forwards routing.

    This line seems to do the trick, but it has a typo. I added it to my routers configuration (I have them in ROUTERSTART section, instead of PREROUTERS).
    The correct one is
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
    #7 andryangouw, Jul 18, 2018
    Last edited: Jul 18, 2018
    PeteS and cPanelMichael like this.
  8. PeteS

    PeteS Well-Known Member

    Joined:
    Jun 8, 2017
    Messages:
    123
    Likes Received:
    18
    Trophy Points:
    18
    Location:
    Oregon
    cPanel Access Level:
    Root Administrator
    Thanks for catching that. Just curious, did it cause an error, just not work, or work even with the incorrect syntax? (I ask because I'm currently not using the AWS SES and can't test, but I thought it was working and I used cut/paste to post here.)

    @cPanelMichael Could you edit the code in my post? I can't seem to find the edit function.
     
  9. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    16,440
    Likes Received:
    416
    Trophy Points:
    583
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    I've updated your post for you. The Edit button is on the bottom right corner of your posts, tools menu, but it's only available for 24 hours from posting I believe.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
    cPanelMichael likes this.
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