Re: [Exim] rewrite rules

Top Page
Delete this message
Reply to this message
Author: Philip Hazel
Date:  
To: Thomas Kinghorn
CC: Exim-Users (E-mail)
Subject: Re: [Exim] rewrite rules
On Tue, 14 Jan 2003, Thomas Kinghorn wrote:

> Is it possible to have the rewrite rules in a file, rather than in the
> cinfig file?
> I am using exim 4.10


Depends on exactly what you mean by that.

(1) You can use .include in the config to include a separate file that
contains the rewrite rules.

(2) You can use lookups in a rewriting rule, for example

*@* ${lookup{$local_part@$domain}lsearch{/some/file}{$value}fail}

> i need to rewrite the the recipient address before sending to the
> manual_route router.


(3) Changing addresses while routing is usually done by the redirect
router, not by rewriting.

> @booksite.co.za                 %1@???
> @dispatch.co.za                 %1@???


The standard Exim way of doing that would be to make the file contain
this:

booksite.co.za                 booksite.jev.co.za
dispatch.co.za                 mail.dispatch.co.za


and use a router like this:

redirect_domains:
driver = redirect
data = ${lookup{$domain}lsearch{/the/file}{$local_part@$value}}

If the lookup fails, the value of "data" is empty, which means that the
router declines. A setting of redirect_router would probably useful to
avoid multiple passes through this router.




--
Philip Hazel            University of Cambridge Computing Service,
ph10@???      Cambridge, England. Phone: +44 1223 334714.