Re: [Exim] Problem rewriting SMTP address

Αρχική Σελίδα
Delete this message
Reply to this message
Συντάκτης: Philip Hazel
Ημερομηνία:  
Προς: John Horne
Υ/ο: exim-users
Αντικείμενο: Re: [Exim] Problem rewriting SMTP address
On Mon, 13 May 2002, John Horne wrote:

> Here I used:
>    ^<?([^@]+)@unqualified\.plymouth\.ac\.uk>?$  \
>             "${if match {$sender_host_name} {(?i).net.plymouth.ac.uk\\$} \
>                  {$local_part@$sender_host_name} {$local_part}}" S

>
>
> However, this does not work. Using 'exim -bh 141.163.0.2' I get:
>
>   220 mary.csd.plymouth.ac.uk ESMTP Exim 3.36 #1 Mon, 13 May 2002 16:56:07
>    +0100
>   mail from: john
>   LOG: Rewrite of john@??? yielded unparseable
>        address: no local part in address @plynms02.net.plymouth.ac.uk

>
> It looks like '$local_part' is not set. So I'm back at square one?


Oh, I'm sorry. I forgot that "S" rewrites are special. Because the input
data may not be a valid address, Exim hasn't pre-parsed it, so of course
$local_part and $domain are not yet set.

I think this is a cleft stick on the horns of a dilemma.

All I can suggest is that you make the second rewriting a non-S rewrite
so that it applies later on in the handling of the message, in which
case the variables will be set. This means, however, that you will need
to adjust your ACL to accept sender addresses of the form
xxx@??? (which presumably will not verify).

Another thought:

If you can somehow avoid using a second regex in your replacement
string, you could revert to your original way of doing this. What you
are trying to test is "ends with .net.plymouth.ac.uk". How about
something like

${if eq {${substr_-19_19:$sender_host_name}}{.net.plymouth.ac.uk}...

That should leave $1 set to the value from the first regex that matched
the SMTP command argument.

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