procmail
[Top] [All Lists]

Re: question regarding header handoff to external script

1999-12-25 14:34:31
Jauder Ho wrote:
Due to my setup (which I can't really change since this is hosted on a
friend's machine) I have need to find a way to pass mail headers to an
external script to extract the IP address check it against RBL. So I need
some help with getting stuff to handoff and come back properly.

I have a script that parses mail headers and returns an IP if it sees a
good one. The script is attached. Feel free to use it.

Well, I don't know perl well enough, but I fed your post to it
and it prints (with no trailing newline) the string:
199.0.65.219137.226144.13137.226.116.240
which doesn't look terribly useful.  I think it's concatenating
an IP from every Received: header.

If you fix that up (and I don't know how you're intending to
pick the "correct" Received: to look at) then...

Here's what I think needs to happen in psuedocode


:0 c
| mailExtractIP 

# (how do we capture the result back from the output of mailExtractIP?)

Try something like:
        # I think you'll want 'c' here but it depends on what you
        # want to do with the rest of the processing:
        :0c
        * any other conditions
        {
          IPVALUE=`mailExtractIP`
          ... stuff using $IPVALUE ...
        }

Hope that helps some,
Stan

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