Re: [exim] relay based on sender address and sender host

Page principale
Supprimer ce message
Répondre à ce message
Auteur: Mike Cardwell
Date:  
À: exim-users
Sujet: Re: [exim] relay based on sender address and sender host
* on the Tue, Feb 20, 2007 at 02:23:53PM +0100, Pickel, Gerd - Betax-Systems GmbH (IT) wrote:

> I just installed exim on a server to act as a gateway and it works fine.
> Now here comes the special demand: from inside the network an Exchange
> server sends mails to the gateway where the sender address looks like
> localpart@???. Exim itself sends these messages back because
> it is configured to relay these message to the Exchange server when
> they were coming from the outside. Now, how can I configure exim to
> check the sender IP/name (Exchange server) and the localpart of an
> email address to relay these messages to a specific mail server
> (IP/name) outside the network?
> I thought about combing sender_address_relay and hostlist relay_hosts
> in a router, but is it the right approach?


You'll find a router for doing the relaying according to mx records
similar to this:

dnslookup:
   debug_print              = "R: dnslookup for $local_part@$domain"
   driver                   = dnslookup
   domains                  = ! +local_domains
   transport                = remote_smtp
   same_domain_copy_routing = yes
 no_more


You want to stick a smarthost router in front of that which delivers to
a specific host on certain conditions. The one below would route all
mail for foo@bar that originated from 123.123.123.123 to the mx
server "the.mx.server" directly:

smarthost:
   debug_print = "R: smarhost for $local_part@$domain"
   driver      = manualroute
   condition   = ${if and{\
                    {eq{$sender_host_address}{123.123.123.123}}\
            {eq{$local_part}{foo}}\
            {eq{$domain}{bar}}\
                 }}
   route_list  = * "the.mx.server"


Hopefully that should give you a basis to work from.

Mike