On Tue, 13 Aug 2002 20:53:23 +0100 (BST), Philip Hazel wrote:
>On Tue, 13 Aug 2002, Ralf G. R. Bergs wrote:
>
>> why doesn't the following work?
>>
>> rabe@??? \
>> "${if eq {${lc:$h_To:}}{someone@???} {rabe-lkt}fail}" fQ
>>
>> I would like to rewrite the "From:" header with "rabe-lkt@<qualify>" if
it's
>> "rabe@???" AND the recipient of the message is
>> "someone@???."
>>
>> I've tried several other variables instead of $h_To: but nothing helped:
>> $received_for, $recipients.
>
>What happened? Did it just not rewrite? What was the contents of the To:
It just didn't rewrite, but you've pointed me at what I did wrong...
>header line when it failed? Are you sure 'eq' is the right test? It
>won't match things like
>
> To: some person <someone@???>
THAT'S the problem!! My mailer writes addresses I enter as
"someone@???" (without the double quotes) like follows:
"someone@???" <someone@???>
>for example (not to mention more exotic RFC 822-isms). And what do you
>want to happen for messages that are sent to more than one recipient?
>Rewrite or not rewrite?
I'm well aware of these problems, but they're only of academic nature. I need
only handle these simplest cases like the above.
Thanks to your helpful hint I was able to get this running. My rewrite rule
now looks like this:
rabe@??? \
"${if and {
{def:h_To:}
{match
{$h_To:}
{\\N^(\"someone@???\" )?<?someone@???>?$\\N}
}
} {rabe-lkt} fail
}" fFrQ
I've broken the line to make it more readable, I hope it's still obvious how
the expression looks like.
The pattern recognizes addresses like the following:
"someone@???" <someone@???>
<someone@???>
someone@???
Is this, in your eyes, the optimal way of writing this, or can you give me
additional hints about how to further improve it?
Thanks,
Ralf
--
Sign the EU petition against SPAM: L I N U X .~.
http://www.politik-digital.de/spam/ The Choice /V\
of a GNU /( )\
Generation ^^-^^