procmail
[Top] [All Lists]

Re: What am I missing

1999-04-01 23:01:35
At 16:04 +0300 01 Apr 1999, era eriksson <era(_at_)iki(_dot_)fi> wrote:
You could do better still, because if your MTA stamps the topmost
Received: header with the originating system's IP number, you can
simply grab it from there. Poof, no external process, no need for
origip.pl at all. This has been described by Aaron Schrab in
<http://www.xray.mpe.mpg.de/mailing-lists/procmail/1998-02/msg00034.html>

(You don't really need the scoring stuff if you just construct a
single regex which covers all your local hosts; for current-ish
Sendmail installations, an adaptation of Aaron's recipe would be
something along the lines of

    :0
    * ^Received: from[^])]*\[\/[0-9]+\.[0-9.]+\]\)\<*by\>+${MONSTER_REGEX}
    {

That doesn't quite work; it will match the topmost received header, and
if the message went through several "local" mail servers, it will get
the address of one of those.  Scoring is required to get around this,
but you don't need to get as complicated as I did in the referenced
message.  I'm currently using:

# Using scoring forces procmail to use the last match
#   tip from David W. Tamkin
:0
* $ 1^1 ^Received:.*\[\/[0-9.]+\]\) by ${LOCALSERVER}
* MATCH ?? ^^\/[0-9.]+

-- 
Aaron Schrab     aaron(_at_)schrab(_dot_)com      http://www.execpc.com/~aarons/
 In general, if you think something isn't in Perl, try it out,
 because it usually is.  :-)    --Larry Wall

<Prev in Thread] Current Thread [Next in Thread>