Saturday, April 27, 2024
 Popular · Latest · Hot · Upcoming
1
rated 0 times [  1] [ 0]  / answers: 1 / hits: 6095  / 1 Year ago, fri, december 23, 2022, 5:55:14

How do I configure exim4 to route all emails via a third-party SMTP server when the sender's domain, recipient's domain, and server hostname all match?



I followed this great answer and have exim4 sending emails to addresses at other domains tested and working from an Ubuntu server. My only issue is that emails where both the sender and recipient share the same domain as the server hostname, they never leave the server (and this is the expected behavior).



For example, sending from [email protected] --> [email protected] works fine, but sending from [email protected] --> [email protected] just routes the mail locally to /var/mail/account2, without passing through the third-party SMTP server.



I'm using Google Apps at my own domain and want to send emails from [email protected] to [email protected] from a machine with the hostname example.com.



I want to route them through Google's SMTP server so I see them in my other email clients. Is this possible?



Very similar questions (but for postfix) here and here.


More From » server

 Answers
7

If you followed the guide linked in my question you have about a dozen different 'routers' (simple text files) in /etc/exim4/conf.d/router/. The one to edit is 200_exim4-config-primary, like so:



sudo nano /etc/exim4/conf.d/router/200_exim4-config_primary



Down the bottom is a section 'smarthost:' that looks like this:



smarthost:
debug_print = "R: smarthost for $local_part@$domain"
driver = manualroute
domains = ! +local_domains
transport = remote_smtp_smarthost
route_list = * DCsmarthost byname
host_find_failed = defer
same_domain_copy_routing = yes
no_more


Remove the exclamation point and a space from the 'domains' line so that it looks like this:



  domains = +local_domains


That two-character edit was all it took to get everything working just now. Tested and working with Google Apps at my domain on Ubuntu Server 12.04 + Exim & thanks to Stefan for the clue!


[#24855] Saturday, December 24, 2022, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
restlerfin

Total Points: 347
Total Questions: 112
Total Answers: 108

Location: Ukraine
Member since Wed, Dec 16, 2020
3 Years ago
;