Re: [Exim] replacement for smail's pathalias driver

Page principale
Supprimer ce message
Répondre à ce message
Auteur: Philip Hazel
Date:  
À: John Jetmore
CC: exim-users
Sujet: Re: [Exim] replacement for smail's pathalias driver
On Fri, 15 Jun 2001, John Jetmore wrote:

> at what point does the translation from 2scan.domain.com to
> scanned.domain.com take place in that router?


Ah. Sorry, I misread that (late on Friday afternoon). There's no
translation going on here. Exim is just routing the domain
2scan.domain.com to the server private-mail.domain.com. I didn't notice
that your RCPT was different to the original address.

> > > Say I have a message which is to user@???. When exim sees
> > > that, I want it to deliver to the server private-mail.domain.com and in
> > > the smtp transaction, I want it to "RCPT TO: user@???".
> >
> > Easy-peasy:
> >
> > scan_outbound:
> > driver = domainlist
> > transport = remote_smtp
> > route_list = 2scan.domain.com private-mail.domain.com byname


I see that this isn't what you asked for originally:

> I need a router that can both rewrite the envelope-to domain of the email
> and also explicitly direct to a specific server (ignoring MX records and
> whatnot).


Which I had noticed, and was going to answer when I'd thought about it.
One way to do this in Exim is to split the work between a rewriting rule
and a router. Exactly how you do this depends on how you want to handle
incoming messages addressed to xxx@???. Do you want to
handle this differently to those for 2scan.domain.com? The easy case is
if you do NOT. That is, if you want to route scanned.domain.com to
private-mail.domain.com. Then you can do this:

1a. Set up a rewriting rule that rewrites envelope recipients:

*@2scan.domain.com $local_part@??? T

1b. An alternative way of doing this is to make 2scan.domain.com a local
domain, and use a smartuser to change it:

  change_scan:
    driver = smartuser
    domains = 2scan.domain.com
    new_address = ${quote:$local_part}@???


2. Set up a domainlist router that routes scanned.domain.com to
private-mail.domain.com (like the above, but with different pattern).

If, on the other hand, you want to treat mail that is actually addressed
to scanned.domain.com differently to mail addressed to 2scan.domain.com,
it's a bit more complicated. I think I can see how to do it, but I'm not
going to spend time on the detail unless this is really what you want to
do. (You have to make 2scan.domain.com a local domain, and use a
smartuser on it. In a smartuser, you can both change the envelope
address and direct the message to a specific transport, which can set up
the host explicitly.)

Note: In Exim 4 this kind of thing will be a bit easier, because there
is no longer a distinction between routers and directors. You can have
three routers: the first handles scanned.domain.com normally; the second
aliases 2scan.domain.com to scanned.domain.com; the third handles
scanned.domain.com specially. If you see what I mean.


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