[exim] Select transport in router, depending of domain

Top Page
Delete this message
Reply to this message
Author: Prosto Admin
Date:  
To: exim-users
Subject: [exim] Select transport in router, depending of domain
Hi all!

I have two local domains (2 active directory domains (cross truested))
in one local network.
And i have two external domain (valid MX).
for example:
local: domain1.local and domain2.local
external: domain1.external and domain2.external

Need configuration - local domains can cross writing mails to each one,
and if local user write to external world, it sender address rewrite to
external domain: "domain1.local" to "domain1.external".
If from external world some one write to my external domain, exim need
rewrite recipient address to local domain.

Exim auth user by LDAP, and all work.
For implement address rewrite, i declare for each domain separate transport.

I need on router "dnslookup" select transport by it $domain section.


My example of router dnslookup (it not work):
-----------------------------------------------------------
dnslookup:
   driver = dnslokup
   domains = ! +internal_domains : ! +external_domains
   transport = ${
     if {$domain} match {\N\.domain1\.local$\N}
       then
         domain1_local_smtp
     elif
       {$domain} match {\N\.domain2\.local$\N}
       then
         domain2_local_smtp
     elif
       {$domain} match {\N\.domain1\.external$\N}
       then
         domain1_external_smtp
     elif
       {$domain} match {\N\.domain2\.external$\N}
       then
         domain2_external_smtp
     elif
        fail
     endif
   }
   no_more
-----------------------------------------------------------



Transport example:
-----------------------------------------------------------
domain1_local_smtp:
headers_rewrite = *@domain1.external \

${lookup{$0}lsearch{/usr/local/etc/exim/rewrite_external_domain1.lst}{$value}fail}
   return_path = \
     ${if match{$return_path}{\N^([^@]+)@(.*)\.domain1\.local$\N} \
     {\


${lookup{$0}lsearch{/usr/local/etc/exim/rewrite_external_domain1.lst}{$value}fail}\
      }\
fail}
-----------------------------------------------------------


Router example not work, but please suggest construction for it works as
i planned. Or point my to documentation that can by explain how make
rewriting for this case.