Bugorr has asked for the wisdom of the Perl Monks concerning the following question:

Greetings, I'm trying to set up a script that gets called when sendmail receives email. Can anybody point to a good sample or help with beginning of the script and reading the message itself. Thank you in advance, Bugorr

Replies are listed 'Best First'.
Re: Perl and Sendmail
by 5mi11er (Deacon) on Aug 12, 2005 at 22:43 UTC
    Google for procmail if you're doing this for a specific user account. Done for you.

    Or, maybe spamassasin if doing this for all mail received on the machine...

    -Scott

Re: Perl and Sendmail
by chas (Priest) on Aug 13, 2005 at 12:28 UTC
    On Linux, I use a .forward file of the form:
    myusername |/home/myusername/bin/wmail.pl
    My wmail.pl file has a line:
    @text=<>;
    and then I process the contents in various ways (e.g., filtering some messages, putting some in a file I can read in a web browser, etc.) Pretty rudimentary, but it works well for me.
    chas
    (Update-remark: The .forward file sends my emails to the usual spool via the first line, and then I can do anything else with it with the script. The first line could be omitted; I included it to have a backup file.)