procmail
[Top] [All Lists]

Re: sending message to a perl program

1999-10-28 17:34:34
Louis Proyect <lnp3(_at_)panix(_dot_)com> writes:
Sorry for asking an obvious "newbie" question, but I am trying to pass an
incoming mail message to a perl program where it can be processed through
MHonarc, a mailing list archiving program. I need to examine the contents
of the message in order to send it to the proper directory, which is
date-oriented.

The recipe looks like this:

:0 f
* ^To:(_dot_)*mylist(_at_)lists(_dot_)panix(_dot_)com
|test.pl

The perl program gets initiated, but I don't have access to the actual
message. Is something like this necessary?

Nope.  That recipe should work just fine.  What does the logfile show?
The perl script should be reading the message with the "<>" operator, ala,
        while (<>) {
            ...
        }

I will question whether you really want the 'f' flag on the recipe.
The 'f' flags tell procmail to replace it's idea of the message with
the output of the action.  If the script is just archving a copy of the
message then you don't want that.  If you just want to archive a copy
of the message and still receive it in your inbox then you should use
the 'c' flag.  Hmm, you may also want to use the builting regexp token
^TO_ to match all the possible recipient headers that would specify the
mailing list.

        :0 c
        * ^TO_mylist(_at_)lists\(_dot_)panix\(_dot_)com
        |test.pl


Finally, I'll note that you probably do the necessary date stuff from
inside of procmail, but since you don't describe the task, it's hard
to say.


Philip Guenther

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