For any PHP hackers who're interested, I figured out a somewhat kludgy
solution. Having searched all bloody night I came across this thread, which
correlates closest to my dilemma:
http://marc.theaimsgroup.com/?t=91567522400001
The problem in that thread was the exact same as mine - you can pipe
something in from the command line, but it just won't work with a sendmail
alias for some reason. And as far as I'm concerned, if Rasmus can't figure
it out, better to let it lie. :)
The only way around it was to create a shell script to read the data from
STDIN and then pipe THAT to the PHP script. This is just a simple example
that resends the mail, headers an' all:
----------------------------------------------------------------------
SHELL SCRIPT
#!/path/to/sh
cat |/path/to/php/script
----------------------------------------------------------------------
PHP SCRIPT
#!/path/to/php -q
<?
$fp = @fopen("/dev/stdin", "r");
while (!feof($fp)) {
$rawdata .= fgets($fp, 4096);
}
fclose($fp);
mail ("user at sld.tld", "Subject", $rawdata);
?>
----------------------------------------------------------------------
Then set up an alias for it:
user: |/path/to/shell/script
And if you're running smrsh (like me apparently :), you'll
need to create a link to the shell script for sendmail:
(Maybe this is why I can't get at STDIN from PHP?)
ln -s /path/to/shell/script /path/to/smrsh
Now just rebuild the aliases file and you're done:
newaliases
That's it. I'm off back to my phorums installation now to play with it.
Tata,
adam
PS. Hey Donncha, couldn't you use this for IO? Pipe the data into PHP, parse
the headers, put the resultant data into MySQL and voila, a searchable list
archive (which I just happen to be working on meself :). Then you could
simply reference each email in the DB from the hierarchy of topics you've
already created. Searchable, threaded list archive and IO in one! And if you
want a real challenge, well, Majordomo & HyperNews are getting a bit boring
aren't they? And MARC is a bit dull looking too! :)
adam
_______________________________________________________
<?php
$s=array("J","A","p","h","p","H");
for($i=0;$i<count($s);$i++){echo$s[$i];}
?> :)
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!