[Gllug] Using sendmail to execute PHP scripts

Peter Adamson peter.adamson at ktsplc.com
Thu May 1 07:55:08 UTC 2003


Hi.
I've got a nice little php script from somwhere (can't remember where)
which takes emails via a pipe, stripes out attachments and puts the
message along with some header info into a mySQL database.

The problem I'm having is getting sendmail to actually execute the
script when an email comes in from a specific user.

/etc/aliases has:
#This is a test account for the email-mysql gateway
test_support: "| php /home/peter/bin/gateway.php"

To make sure security isn't an issue I've been naughty:
#Mprog,         P=/usr/sbin/smrsh, F=lsDFMoqeu9, S=10/30, R=20/40,
D=$z:/,
#               T=X-Unix,
#               A=sh -c $u

Mprog,         P=/usr/sh, F=lsDFMoqeu9, S=10/30, R=20/40, D=$z:/,
               T=X-Unix,
               A=sh -c $u

The error message I'm getting back is:
The original message was received at Tue, 29 Apr 2003 12:33:43 +0100
from [192.168.100.205]

   ----- The following addresses had permanent fatal errors -----
"| php /home/peter/bin/gateway.php"
    (expanded from: <test_support at voyager.bluearrow.net>)

   ----- Transcript of session follows -----
554 "| php /home/peter/bin/gateway.php"... unknown mailer error 255

I've been trying different combinations of calling PHP (full path etc)
I've also been able to simulate giving the PHP info via a pipe:

echo "foobar" | /usr/local/bin/php gateway.php

This works ok.
(I have tried expanding the absolute path for php btw in the
/etc/aliases file"

cheers,
Peter


-- 
Gllug mailing list  -  Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug




More information about the GLLUG mailing list