Re: [EXIM] Rewriting for not-local_domains

Startseite
Nachricht löschen
Nachricht beantworten
Autor: Philip Hazel
Datum:  
To: Andreas Edler
CC: exim-users
Betreff: Re: [EXIM] Rewriting for not-local_domains
On Wed, 8 Jul 1998, Andreas Edler wrote:

> for an intranet mailserver I want to do rewriting only if the
> recipient is not in the $local_domain.
>
> *@intra.net \
> {if recipient is not in $local_domain} user@??? \
> Ffs
>
> Is this possible and how do I have to write my rewriting rule?


In general it is not possible, because a message may have many
recipients, so you can't talk about "the recipient".

Or do you mean do rewriting only if the domain of the address being
rewritten is not a local domain? You could do that by putting your local
domains in a file, setting

local_domains = lsearch;/list/of/local/domains

and using a rewriting rule of the form

*@*  "${lookup {$domain}lsearch{/list/of/local/domains}\
      {$1@$2}{<whatever rewriting you want>}}"   <flags>


However, this is inelegant, because for local domains it does rewrite,
but to what it was before.

A less expensive, but slightly more dodgy technique is

LOCAL_DOMAINS = your.domain:your.other.domain

local_domains = LOCAL_DOMAINS

*@*  "${if !match{LOCAL_DOMAINS}{${rxquote:$domain}}\
     {<whatever rewriting you want>} fail}"  <flags>


which does have the advantage of not doing a useless rewrite for local
domains, and doesn't require a file lookup. However, the test is
obviously only approximate. If you have only one local domain, you could
make it an exact test.

-- 
Philip Hazel                   University Computing Service,
P.Hazel@???          New Museums Site, Cambridge CB2 3QG,
ph10@??? (sic)       England.  Phone: +44 1223 334714



--
*** Exim information can be found at http://www.exim.org/ ***