Re: [exim] Smarthost with a local adress

Etusivu
Poista viesti
Vastaa
Lähettäjä: Dominic Benson
Päiväys:  
Vastaanottaja: exim-users
Aihe: Re: [exim] Smarthost with a local adress

On 4 Feb 2011, at 08:44, Sébastien CARRE wrote:

> Hello,
>
>
> I'm trying to add a new filter (or rule?) in our Exim 4 server.
>
> I want for a specific local destination adress (user1@localdomain) to
> redirect it with smarthost.


Am I correct in interpreting that as "forward all mail TO user1@localdomain to a different [local/under your control] server?

As a precautionary note, you may also need to reconfigure the other server too, if it might source/receive mail for other addresses at your domain, to make them come back to the first host.

The easiest way of getting a comparable result is to forward user1@localdomain to user1@??? in your aliases file/table on the first box, and reconfigure the second one to consider foo.localdomain as the accepted domain. Possibly also add foo.localdomain as a relay domain on the first box. If you feel strongly, and it issues mail, you could make the second box rewrite mail from user1@??? to user1@localdomain.

To do exactly what you want, you could add a

warn:
domains = +local_domains
local_parts = user1
set acl_m_redirect = 1

to the rcpt acl, and then add an alternative router (before local delivery):

forward_not_quite_local:
    driver = manualroute
    condition = ${if eq{$acl_m_redirect}{1}{1}{0}} 
    route_data = box2.localdomain
    transport = remote_smtp



I have used subcomponents of this, but the actual acl rule and router are cobbled together in my head, so they might be a bit off.
>
>
> I searched on Internet and found this :
>
> Modified the config file to :
>
> .ifndef DCsmarthost
> DCdefault_sh = DEBCONFsmarthostDEBCONF
> DCsmarthost =
> ${lookup{$sender_address}lsearch{CONFDIR/smarthost_per_user}{$value}{DCd
> efault_sh}}
> .endif
>
> Created the smarthost_per_user file with :
> user1@localdomain : smarthost_adress


If I'm not mistaken, this allows you to choose *which* smarthost to use for outgoing mail on a per-user basis. Unless I misunderstood what you want to do, I don't think this is the right approach.
>
>
> Restarted Exim, no problems all seems to work.
>
> But this doesn't work because the adress is in the localdomain, so not
> routed with the smarthost...


This is dependent on router order. Whatever you settle on, if you don't change the domain of the user being relayed, you'll have to have the router that handles it before the local delivery one, for exactly this reason.
>
> Does anyone know a solution for this ? :)
>
> Thanks to all for you're reply.
>
> Sebastien
>


Dominic