Skip to main content

Use Exim smarthost for only single email address

Comments

18 comments

  • cPanelMichael
    How can I setup Exim to use the smarthost only for a single email address so that if an email from anyone other than that address are being processed by Exim it will use the standard Exim configuration as if there is no smarthost and if there is an email being sent by either our email client or the server that uses ouraccount@gmail.com[/EMAIL], it will be processed by the smarthost?

    Hello :) There's a thread on this at: Forward certain domain emails to Smart Host Thank you.
    0
  • dr_lucas
    Yes, I have read that thread, but it discusses sending whole domain emails to smarthost. I need to know hot set it up to send only 1 specific email address of a domain to smarthost, not all the domain's email addresses. Thank you
    0
  • cPanelMichael
    There's a thread on per-email-account smart host configurations at: Routing email to external server using EXIM smarthost config. Thank you.
    0
  • dr_lucas
    Yes, that thread suggests adding local_parts= user Does that mean that if I want, for example, to use the smarthost only for info@ourdomain.com and process normally without smarthost all other emails, I should rewrite my configuration to be: send_via_gmail: driver = manualroute domains = ! +local_domains local_parts= user transport = gmail_smtp route_list = * smtp.gmail.com OR send_via_gmail: driver = manualroute domains = ! +local_domains local_parts= info@ourdomain.com transport = gmail_smtp route_list = * smtp.gmail.com OR send_via_gmail: driver = manualroute domains = ourdomain.com local_parts= user transport = gmail_smtp route_list = * smtp.gmail.com OR send_via_gmail: driver = manualroute domains = ourdomain.com local_parts= info transport = gmail_smtp route_list = * smtp.gmail.com Or something else?
    0
  • cPanelMichael
    I've looked through the following document from Exim: 20. The manualroute router From what I understand, it should look like this:
    send_via_gmail: driver = manualroute domains = ! +local_domains senders = user@example.tld transport = gmail_smtp route_list = "* smtp.gmail.com"
    Note that some users choose to add additional values such as "host_find_failed = defer" to keep messages in the queue if the remote mail server is unresponsive. I've found the best way to understand the smart host configurations with Exim is to go line by line and research to see what each value means. For instance, local_domains might not make much sense on it's own, but if you search for it in /etc/exim.conf you see an entry such as:
    domainlist local_domains = lsearch;/etc/localdomains
    Thus, you can infer it's referring to any domain name in the /etc/localdomains file on the server. The "!" symbol is used to negate items. So, when we see this:
    domains = ! +local_domains
    It's negating this manual route for all domain names in /etc/localdomains, so that it only applies to a specific sender that's defined on the next line. Thank you.
    0
  • dr_lucas
    Thanks. Just to clarify, as I am not sure what user@example.tld in your code means You mean I should set it up like this?
    send_via_gmail: driver = manualroute domains = ! +local_domains senders = info@ourdomain.com transport = gmail_smtp route_list = "* smtp.gmail.com" host_find_failed = defer
    0
  • cPanelMichael
    New Thanks. Just to clarify, as I am not sure what user@example.tld[/EMAIL] in your code means

    Yes, in your case it would be "info@ourdomain.com". I've also edited the previous post with some additional information. Thank you.
    0
  • dr_lucas
    Bravo! Seems to work! :) Thanks, Michael!
    0
  • cPanelMichael
    I am happy to see it's working well. Thank you for updating us with the outcome.
    0
  • dr_lucas
    Just curios. You wrote: It's negating this manual route for all domain names in /etc/localdomains, so that it only applies to a specific sender that's defined on the next line.
    So what happens when there are no list of senders in the next line, as in my original example:
    Section: ROUTERSTART send_via_gmail: driver = manualroute domains = ! +local_domains transport = gmail_smtp route_list = * smtp.gmail.com
    0
  • cPanelMichael
    So what happens when there are no list of senders in the next line, as in my original example:

    The expected behavior is that no email accounts or domain names would use that smart host. Thank you.
    0
  • dr_lucas
    The expected behavior is that no email accounts or domain names would use that smart host.

    But what actually happens is that all email accounts and domains use the smart host.
    0
  • cPanelMichael
    Could you elaborate on all custom entries you are utilizing with Exim? For instance, is that the only change you have made to the Exim configuration for email routing? Thank you.
    0
  • dr_lucas
    Could you elaborate on all custom entries you are utilizing with Exim? For instance, is that the only change you have made to the Exim configuration for email routing? Thank you.

    Yes, Michael, the configuration in the OP is the only configuration change I have made for email routing. You can test this yourself, I am sure you will see the same results.
    0
  • dr_lucas
    Seems I was wrong. The suggested setup didn't work properly. All emails from info@ourdomain.com did go through fine. However, all other emails sent to our domain email addresses or from other email addresses on our domain got routed through the smarthost and rejected. :( Any other suggestions?
    0
  • cPanelMichael
    You may want to post to the Exim users mailing list for additional user-feedback to this type of custom configuration: Exim-users Thank you.
    0
  • tufancap
    yes it works

    send_via_gmail: driver = manualroute domains = ! +local_domains senders = info@ourdomain.com transport = gmail_smtp route_list = "* smtp.gmail.com" host_find_failed = defer
    - but only valid for 1 email address ! -I tried a few fictions 1- senders = info@ourdomain.com, info@ourdomain2.com (does not work after the comma. first typed e-mail address continues to work) 2- senders = ourdomain.com (Doesn't work for outgoing emails from domains) This is the fiction I want what i write I can relay from all email addresses on that domain. and I can add 5,6,15 domains
    0
  • tufancap
    my current settings are like this @ROUTERSTART@ send_via_mammamia: driver = manualroute domains = ! +local_domains senders = support@mydomain.com transport = mamamia_smtp route_list = * outbound.smtpdomain.com how should it be @ROUTERSTART@ send_via_mammamia: driver = manualroute domains = ! +local_domains senders = mydomain.com not working transport = mamamia_smtp route_list = * outbound.smtpdomain.com
    0

Please sign in to leave a comment.