From owner-freebsd-questions Wed Apr 9 08:52:05 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id IAA27659 for questions-outgoing; Wed, 9 Apr 1997 08:52:05 -0700 (PDT) Received: (from jmb@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id IAA27616; Wed, 9 Apr 1997 08:51:56 -0700 (PDT) From: "Jonathan M. Bresler" Message-Id: <199704091551.IAA27616@freefall.freebsd.org> Subject: Re: Sendmail rule help needed To: paul@nation-net.com (Paul Walsh) Date: Wed, 9 Apr 1997 08:51:56 -0700 (PDT) Cc: questions@freebsd.org In-Reply-To: <334B782B.1DAF@nation-net.com> from "Paul Walsh" at Apr 9, 97 10:06:19 am X-Mailer: ELM [version 2.4 PL24] Content-Type: text Sender: owner-questions@freebsd.org X-Loop: FreeBSD.org Precedence: bulk Paul Walsh wrote: > > Hi, it's good to be back. > > I am trying to rewrite all mail for a domain abc.co.uk to xyz.co.uk retaining the user part. > > I have a virtualhosts file set up which is working fine for > user1@domain1 -> user2@domain2 > domain -> user@domain > > but these existing rules that I have won't map properly for > domain1 -> domain2 > which is what I want! > > S98 > ############################# PW ########## > # Sendmail for virtual domains PW 4 OCT 1996 > ######################################## > R$+ < @ $+ . > $: $1 < @ $2 > . > R$+ < @ $+ > $* $: $(virtualhosts $1@$2 $: $1 < @ $2 > $3 $) > R$+ < @ $+ > $* $: $(virtualhosts $2 $: $1 < @ $2 > $3 $) > R$+ < @ $* > . $: $1 < @ $2 . > > ######################### done PW ######### are you using m4 to create your .cf files? S98 is the result of LOCAL_RULE_0. why not use the virtusertable feature? ti will reroute mail for user@host to someone@somewhere. the mapping is repeated till no additional changes result. beware loops! sendmail s trying after 50 mappings. this rewrites the user,host part of the user,host,mailer triple only. lookup key is "user@host" if that fails lookup key is "host" if that fails too no write takes place. jmb > > I tried adding: > R< @ $+ > $: $(virtualhosts $1 $: < @ $1 > $) > with a line: > xyz.com abc.com > in virtualhosts and Cwxyz.com, but it doesn't work ( user not known ) > > ... so I added a quick n dirty fix > > # PW forward vlh.co.uk mail > R$+ < @ granby.co.uk > $* $#smtp $: $1 < @ granbyms.demon.co.uk > $2 > > which kind of works ( but not for local users) but isn't using virtualhosts. > > Can anybody help? > > > Regards, Paul Walsh >