procmail
[Top] [All Lists]

Re: How do I send output to a program?

2000-08-02 01:12:13
On Tue, 1 Aug 2000, Professional Software Engineering wrote:

i would like to get the HEADER and the MESSAGE from the mail sent to my
program, how would i do this?

:0
* ^TOguestbook(_at_)mydomain(_dot_)com
* !^FROM_DAEMON
|/usr/www/cgi-bin/php3.cgi -q myscript.php3 $HEADER $MESSAGE

Uh, you're piping the message (header/blankline/body) into the program (see 
the pipe | symbol?), not passing them in as commandline arguments (they're 
not stored as environment variables anyway).

Consider rewriting your script to take input from stdin.  If not, I guess 
you could always write a wrapper script to take input from stdin and drop 
it into a couple of variables, but you'd no doubt run into trouble the 
first time you got a large message.

Use "xargs".  It converts stdin to command line arguments.

|xargs /usr/www/cgi-bin/php3.cgi -q myscript.php3

This won't likely work with the $HEADER $MESSAGE idea since it
could be infinitely large, but I thought I'd mention xargs since
most people are unaware of it's utility.

Rewriting the program to read stdin is the most sensible approach
I'd have to agree.

TTYL

-- 
Mike A. Harris                                     Linux advocate     
Computer Consultant                                  GNU advocate  
Capslock Consulting                          Open Source advocate

... Our continuing mission: To seek out knowledge of C, to explore
strange UNIX commands, and to boldly code where no one has man page 4.


_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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