LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] Piping mail to php...

[ILUG] Piping mail to php...

adam beecher adam at iewebs.com
Fri Apr 14 15:10:28 IST 2000


A recent posting on phpbuilder.com reminded me to try something, but I can't
figure it out -- I want to pipe mail into a php script, so I can work with
the data. But first of all I'm just trying to get it to resend. Here's my
setup:

I create a mapping in  the aliases file:

test1234: | /usr/local/php/scripts/mail-redirect.php

And reloaded the aliases with "newaliases".

mail-redirect.php contains:

#!/usr/bin/php -q
<?
$to		= "adam at iewebs.com";
$subject	= "Test Message from redirector";
$headers	= "From: adam at iewebs.com\n";
$fp = fopen("/dev/stdin", "r");
while (!(feof($fp)))

	$buffer = fgets($fp, 4096);
	$content .= $buffer;
}
fclose($fp);
mail($to, $subject, $content, $headers);
?>

The file is owned by root, and is chmodded 755. /usr/local/php is also owned
by root and is chmodded with *just* root rwx permissions (I use the module
for the web).

The bounce I get back from sendmail is:

sh: mail-redirect.php not available for sendmail programs
554 |/usr/local/php/scripts/mail-redirect.php... Service unavailable

The messages in the maillog are:

Apr 14 14:33:33 iewebs sendmail[3538]: OAA03538: from=<adam at iewebs.com>,
size=651, class=0, pri=30651, nrcpts=1,
msgid=<CKEHJINMGKLBFEBJHANPOELKCBAA.adam at iewebs.com>, proto=ESMTP,
relay=wonka.esatclear.ie [194.145.128.5]
Apr 14 14:33:33 iewebs smrsh: uid 8: attempt to use mail-redirect.php
Apr 14 14:33:33 iewebs sendmail[3539]: OAA03538:
to=|/usr/local/php/scripts/mail-redirect.php, delay=00:00:00,
xdelay=00:00:00, mailer=prog, stat=Service unavailable
Apr 14 14:33:33 iewebs sendmail[3539]: OAA03538: OAA03539: DSN: Service
unavailable
Apr 14 14:33:35 iewebs sendmail[3539]: OAA03539:
to=adambeecher at esatclear.ie, delay=00:00:02, xdelay=00:00:02, mailer=esmtp,
relay=wonka.esatclear.ie. [194.145.128.5], stat=Sent (OAA11463 Message
accepted for delivery)

Anybody tell me what's going on? Something simple I've missed possibly?

Cheers,
adam

_______________________________________________________
<?php
$s=array("&#74;","&#65;","&#112;","&#104;","&#112;","&#72;");
for($i=0;$i<count($s);$i++){echo$s[$i];}
?> :)





More information about the ILUG mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


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!
RSS Version
Powered by Dell