tru64-unix-managers (formerly alpha-osf-managers) (1994-2012)
 help / color / mirror / Atom feed
From: Garry Optland <garry () pp ! nsw ! gov ! au>
To: tru64-unix-managers
Subject: Summary: Sending mail to a perl script.
Date: Thu, 02 May 1996 05:47:15 +0000	[thread overview]
Message-ID: <96076332421143.tru64-unix-managers.marc@archive.invalid> (raw)

Hi All,

The answer is to change the alias from:

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

to:

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

I recieved four replies in 30 minutes. Thanks to:

    Andreas Priebe <apr@aip.de>
    drjohn <drjohn@windom.colorado.edu>
    Mahendra Vallabh (Mike) <mike@lucy.cs.waikato.ac.nz>
    Jay Shen <jshen@emperor.kidsat.ucsd.edu>

and any others that may yet answer.

My original question:

>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@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+"$@"}'
>   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@pp.nsw.gov.au
Pacific Power                         phone: +61 2 268 6160
Park & Elizabeth Streets  Sydney  NSW  2001  Australia
--------------------------------------------------------------------

                 reply	other threads:[~1996-05-02  5:47 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox