I have exactly this setup, with a couple of different outgoing
smarthosts that need authentication:
I've added a couple of extra stanzas like this in the routers section
*before* the default router (DNS-based in my case, or via default
smarthost maybe for you). Exim will try each of these, looking at the
condition check and falling through if it's not met:
smarthost_example_exploder:
debug_print = "R: smarthost_example_exploder for $local_part@$domain, from $sender_address"
driver = manualroute
domains = ! +local_domains
transport = remote_smtp_smarthost_exploder
route_list = * smtp.gmail.com::587 byname
host_find_failed = defer
headers_add = X-wibble: sender_address $sender_address
condition = ${if exists{CONFDIR/smtp_auth/$sender_address}{${if eq{$sender_address_domain}{
example.org}}}}
same_domain_copy_routing = yes
I then add the desired authentication details in
/etc/exim4/smtp_auth/$sender_address for each of the sender addresses.
HTH!
Be aware that doing authenticated smtp to Google and O365 (etc.) is
getting harder and harder as they continue to try to destroy
mail as an open service. :-(
--
Steve McIntyre, Cambridge, UK.
st...@einval.com
"We're the technical experts. We were hired so that management could
ignore our recommendations and tell us how to do our jobs." -- Mike Andrews