[exim] headache with remote_smtp

Top Page
Delete this message
Reply to this message
Author: Dmitry Pryadko
Date:  
To: exim-users
Subject: [exim] headache with remote_smtp
I have an exim-based mailserver, which have two tasks:
1) to receive mail for my mail backend with many domains
2) to relay mail from my webservers

First router is manualroute to backends, it declines if recipient
domains is not in relay_to_domains list; and second router is default
dnslookup.
I had to add one more check in my first router - now it declines if
sender host is in relay_from_hosts (because some domains can be in my
database, but real MX records can point to other servers, not mine)

When sending mail from web servers to domains, which MX points to me, i
receive error "451 lowest numbered MX record points to local host"

Here's scheme:

            1. mail for example.com
webserver ----------------------->


             2.ok skipping manualroute, looking up MX
eximserver -------------------------------------------> DNS
           <----------------------------------------
             3.ouch! MX points to me! 451 defer


How can i fix my config to organize relaying to proper destination,
based on DNS data, but including relaying to "myself" ?
****If I have 127.0.0.1 in relay_from_hosts list, can I use
'allow_localhost' option in remote_smtp transport, or it will cause a loop?

relay_to_mailhost:
     driver = manualroute
     domains = +relay_to_domains
     condition = ${if !match_ip{$sender_host_address}{+relay_from_hosts}}
     transport = remote_smtp
     route_data = ${lookup mysql{select mailserver from domains_servers 
where domain='${quote_mysql:$domain}'}}


dnslookup:
driver = dnslookup
domains = ! +local_domains
transport = remote_smtp
ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8
no_more


--
Dmitry Pryadko
hosting.rbc.ru