Exim 4.5 Smarthosts + Debugging

To debug TLS and AUTH in exim, run mailq to check if there are any undelivered mails and run exim -qff -d+all to see what’s happening during the delivery attempt.

Insert this into the transport section of exim.conf to force TLS and AUTH on all accounts:

remote_smtp:
driver = smtp

remote_smtp_smarthost:
driver = smtp
hosts_require_auth = ${if exists {/etc/exim/passwd.client}\
{${lookup{${address:$h_from:}}lsearch*\
@{/etc/exim/smarthosts}}}{}}
hosts_require_tls = ${if exists {/etc/exim/passwd.client}{${lookup{${address:$h_from:}}\
lsearch*@{/etc/exim/smarthosts}}}{}}
tls_tempfail_tryclear = false

Setup the authenticators cram_md5 and plain like this:

cram_md5:
driver = cram_md5
public_name = CRAM-MD5
client_name = ${extract{1}{:}{${lookup{$host}lsearch*\
{/etc/exim/passwd.client}{$value}fail}}}
client_secret = ${extract{2}{:}{${lookup{$host}lsearch*\
{/etc/exim/passwd.client}{$value}fail}}}

plain:
driver = plaintext
public_name = PLAIN
client_send = "^${extract{1}{::}{${lookup{$host}lsearch*\
{/etc/exim/passwd.client}{$value}fail}}}^${extract{2}{::}\
{${lookup{$host}lsearch*\
{/etc/exim/passwd.client}{$value}fail}}}"

Add this router:

smarthost:
debug_print = "R: smarthost for $local_part@$domain"
driver = manualroute
domains = ! +local_domains
transport = remote_smtp_smarthost
route_list = * ${lookup{${address:$h_from:}}lsearch*\
@{/etc/exim/smarthosts}} byname
host_find_failed = defer
same_domain_copy_routing = yes
no_more

And don’t forget to create passwd.client like this:

mailserver.de:user@domain.de:passwd

and smarthosts file:

user@domain.de: mailserver.de

The correct university mail server name is: m1.informatik… (mail.informatik… points to that one).