The document describes how to set up Debian Exim to use a smart host for some
domains, but not for others. For instance, use smtp.example.net as a smart
host for example.org and example.com, and deliver mail to all other domains
directly to their MX-es.
Note: paths are relative to /etc/exim4/.
example.org: smtp.example.net example.com: smtp.example.net
If the smarthost requires a login, put the following in this file;
smtp.example.net:User:PassWord
This file is mode 640 (-rw-r-----), root:Debian-exim
If the smarthost requires a login, you may want to force TLS;
# Conditional smarthost REMOTE_SMTP_SMARTHOST_HOSTS_REQUIRE_TLS = smtp.example.net
TLS needs to be configured for this to work.
If the smarthost requires a login, you need to change '150_exim4-config_hubbed_hosts'. The changes are marked with my initials ('RvdP') and green text.
# router/150_exim4-config_hubbed_hosts ################################# # route specific domains manually. # # see exim4-config_files(5) and spec.txt chapter 20.3 through 20.7 for # more detailed documentation. hubbed_hosts: debug_print = "R: hubbed_hosts for $domain" driver = manualroute domains = "${if exists{CONFDIR/hubbed_hosts}\ {partial-lsearch;CONFDIR/hubbed_hosts}\ fail}" same_domain_copy_routing = yes route_data = ${lookup{$domain}partial-lsearch{CONFDIR/hubbed_hosts}} # RvdP, changed # transport = remote_smtp transport = remote_smtp_smarthost
Without the change from 'remote_smtp' to 'remote_smtp_smarthost' Exim won't authenticate.
With 'exim -bt' you can do some really nice tests. It fakes a SMTP session and tells you wat it would have done, if the session was real.
~$ exim -bt john@example.org john@example.org router = smarthost, transport = remote_smtp_smarthost host smtp.example.net [192.168.1.1]
Do this for local delivery, remote delivery and delivery via smarthost.