Re: [exim] RHS expansion a la mailertable

Página superior
Eliminar este mensaje
Responder a este mensaje
Autor: Philip Hazel
Fecha:  
A: vas
Cc: exim-users
Asunto: Re: [exim] RHS expansion a la mailertable
On Mon, 13 Feb 2006, vas@??? wrote:

> Colleagues,
>
> In mailertable (sendmail) I can write
> .old-company.com = smtp:%1.new-company.com
>
> In the CGP routing table I can write:
> *.old-company.com = *.new-company.com
>
> How do I achieve the same RHS expansion in an exim router (in route_data)?


What do you actually want to achieve? There are two possibilities:

(1) Rewrite addresses of the form *@*.old-company.com and then route on
the rewritten address.

(2) Don't rewrite, but route the mail as if addressed to *.new-company.

You can do (1) by adding a rewriting rule, not a router. Something like

*@*.old-company.com $1@$2.new-company.com

Not tested. You can do (2) by this router:

rr:
driver = manualroute
route_list = \N^(.*)\.old-company\.com$ $1.new-company.com/mx
transport = remote_smtp

Also untested, and it assumes that the route to the new company can
be discovered from MX records. You can use route_data instead of
route_list if there are lots of these. You would have something like

route_data = ${lookup{$domain}partial-lsearch{/some/file}{$1.$value}}

and the file would contain lines like

*.old-company.com new-company.com

Again, untested. Or you could probably use nwildsearch instead, for more
complicated patterns.

Or you could just use a redirect router:

rr:
  driver = redirect
  domains = *.old-company.com
  data = $local_part@${sg{$domain}{\N^(.*)\.old-company\.com$\N}\
         {$1.new-company.com}}


In other words, there are lots of ways of doing it...    



-- 
Philip Hazel            University of Cambridge Computing Service
Get the Exim 4 book:    http://www.uit.co.uk/exim-book