Sending mail to a perl script.

From: Garry Optland <garry_at_pp.nsw.gov.au>
Date: Thu, 2 May 1996 14:06:56 +1000 (EST)

Hi All,

I wonder if anyone has an example of sending mail to a perl script. I
want to set up a mail alias that takes the mail message and passes it to
a perl script where it is further processed.

I am using sendmail 8.7.4, with IDA. In the alias file I tried:

test: "| /usr/bin/cat > /tmp/test"

This works OK.

I then created a perl script that takes stdin and writes it to a file. I
can test it from the command line, ie:

cat mailfile | test.pl

and it works OK.

When I change the xaliases file to:

test: "| /usr/local/mail/bin/test.pl"

I get error messages from sendmail:

   ----- The following addresses have delivery notifications -----
"| /usr/local/mail/bin/test" (unrecoverable error)
    (expanded from: <test_at_pp.nsw.gov.au>)
                                                                   
   ----- Transcript of session follows -----
/usr/local/mail/bin/test: /usr/bin/perl: cannot execute
 554 "| /usr/local/mail/bin/test"... unknown mailer error 1

I have tried without success sending mail to a script starting with:
#!/usr/bin/perl, and with:

#!/bin/sh
eval 'exec /usr/bin/perl -S $0 ${1+"$_at_"}'
   if 0;

(As per the perl book).

At this stage, I am lost, and would really appreciate it if someone could
show me how to send mail to a perl script.
 
Regards,
         Garry.

--------------------------------------------------------------------
Garry Optland - Unix Specialist Email: garry_at_pp.nsw.gov.au
Pacific Power phone: +61 2 268 6160
Park & Elizabeth Streets Sydney NSW 2001 Australia
--------------------------------------------------------------------
Received on Thu May 02 1996 - 06:28:23 NZST

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:46 NZDT