Re: [Exim] expansion string syntax

Startseite
Nachricht löschen
Nachricht beantworten
Autor: Rick Ennis
Datum:  
To: Wakko Warner
CC: exim-users
Betreff: Re: [Exim] expansion string syntax
Well I finally managed to get it work in the router. I still don't know
what I was doing wrong before. But now $local_part@$domain is giving me
what I want. I ended up adding a header in an ACL and checking it in the
router, so I don't have to do as much with Postgres once I'm there. In the
end, it's a little complicated, but works!

Thanks for the suggestions.


----- Original Message -----
From: "Wakko Warner" <wakko@???>
To: "Rick Ennis" <rge1@???>
Cc: <exim-users@???>
Sent: Thursday, June 05, 2003 7:30 PM
Subject: Re: [Exim] expansion string syntax


> > We have a fairly small site (< 20 users) and I'm playing around trying

to
>
> That's large compared to mine =) (I only host myself noone else)
>
> > headers_add = ${lookup pgsql{insert into filter_private (username,

address)
> > values ('${expand:{match{$h_Received:}{\Nas user (\w+)@\N} }}',
> > '$local_part@$domain')}}
>
> Someone may say this is the wrong place for it. I'm sure a router can see
> the address, you just have to figure out how to keep it to 1.
> the match{}{} is a condition for use in ${if ... not for use the way

you're
> using it.
>
> > I'm doing it in a headers_add directive b/c I couldn't find a better

place
> > to do the expansion. In this case, I only care if the INSERT actually
> > works, not any resulting header. So I'm trying to use the regex "as
> > user(\w+)@" to pull the sender's username out of the Received header.

The
> > $local_part@$domain part works great. But the expansion fails with:
>
> Read how ${lookup works. at the end, if you really want nothing to be
> added, make sure you put {}{} just before the last } that way, if the
> "lookup" succeeds, it's nothing and if the lookup fails (due to server

down
> or something) it'll be nothing.
>
> > 2003-06-05 15:25:43 19O0Mn-00071c-NW == sdsdfsdf333332@???

R=dns_mx
> > T=remote_smtp defer (-25): failed to expand headers_add or

headers_remove:
> > lookup of "insert into filter_private (username, address) values
> > ('{match{from nobody by han.ecloud.net with local (Exim 4.20)\n       id
> > 19O0Mn-00071c-NW\n   for sdsdfsdf333332@???; Thu, 05 Jun 2003
> > 15:25:41 -0400\nfrom 66.31.42.79 ( [66.31.42.79])\n      as user
> > ennis@192.168.0.2 by ecloud.net with HTTP;\n    Thu,  5 Jun 2003
> > 15:25:41 -0400{as user (\w+)@" gave DEFER: PGSQL: query failed: ERROR:
> > parser: unterminated quoted string at or near "'{match{from nobody by
>                                                   ^^^^^^^^
> > Could this be a quoting issue like it says?  I'm using \N on the regex

and
> > ${quote: on the received header.
> > I'm out of ideas. Any suggestions?
>
> Looks like an RTFM issue. \N tells the expansion routine to stop

expanding
> and copy literally until the next \N or EOL.
>
> --
> Lab tests show that use of micro$oft causes cancer in lab animals
>
>