procmail
[Top] [All Lists]

Re: Piping From Line to PERL Script

1997-11-24 10:03:26
Liston Bias <bias(_at_)pobox(_dot_)com> writes:
Please ignore posting... I did not absolutely reference the file I wanted
to write to.  After changing this, it work fine.  For those that may want
to do this in the future, the coding is as simple as:

---------------- .procmailrc -------------------

SUBJECT=`formail -xSubject:`
FROM=`formail -rt -xTo:`

:0 
|/home/username/test.pl ${FROM} ${SUBJECT}

That should be:

        :0
        |/home/username/test.pl "${FROM}" "${SUBJECT}"

The quotes keep the variables from being split into multiple arguments
to the script.  This way, $ARGV[1] will contain the entire subject.
The braces around the variable name are optional, of course.


HOWEVER, it would be more efficient to just have your script extract
the headers itself, as the message is availible to it on STDIN.  If you
aren't reading the message right now, then you should add the 'i' flag
to the recipe, as otherwise a large message (>PIPEBUF in size) will
cause procmail to think the action failed.

The actual code needed to extract the sender address and subject vary
depending on what you're doing with the message.  If you do this, don't
forget to handle header continuations.


Philip Guenther

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