Re: [exim] conditional compound rewriting

Top Page
Delete this message
Reply to this message
Author: Phil Pennock
Date:  
To: Paul Rogers
CC: exim-users
Subject: Re: [exim] conditional compound rewriting
On 2009-11-20 at 09:38 -0800, Paul Rogers wrote:
> On Fri, 20 Nov 2009 01:04:18 -0800, "Phil Pennock" <exim-
> users@???> said:
> > *blink* Bear in mind I can't test any responses to be sure I remember
> > the details. It's been too many years since I admin'd an Exim 3 box
> > to be sure.
>
> That's OK, although it seems like I have a fiddly syntax problem, that
> may just be a symptom of taking a whole wrong approach to the ISP relay
> problem. Thanks for considering it. Most ignore such requests.
>
> So let's clarify whether I'm trying to write a doomed rule. Just the
> lookup part will rewrite the headers/addresses and relay messages
> through my ISP. But EVERYTHING ends up going there, like bounce
> messages. What I'm trying to do now is "if the recipient is 'offsite'
> then rewrite the headers & envelope, else fail" so local messages don't
> get redirected. I know there's an unparsed string $recipient, which
> could be a list and hard to parse in a rewrite rule. I'm trying to find
> some other way, but it seems the rewrite rules, at least in 3.2,
> consider recipient and sender addresses as virtually unrelated from a
> rewriting perspective.
>
> Should I take what I've got and live with it? Or do I just need a
> different strategy?


Using rewrites for routing is doomed to failure in Exim.

Using Exim 4, you'd use headers_rewrite on your SMTP transport. Exim 4
should be buildable in a version as small as Exim 3, unless you're stuck
using packages built by an OS packager and they don't provide a minimal
Exim 4 build, just a kitchen-sink one. (Debian provide
exim4-daemon-light).

That said, you might try using a regexp for matching the addresses
you're filtering and using a negative lookahead assertion.

^([^@]+)@((?!example\.com).+)

That will only match if the domain is not example.com and might get you
closer to what you're trying to achieve.

-Phil