procmail don't execute php script

Posted by Phliplip on Server Fault See other posts from Server Fault or by Phliplip
Published on 2011-01-17T09:32:09Z Indexed on 2011/01/17 9:54 UTC
Read the original article Hit count: 379

Filed under:
|
|
|

Hi,

I have setup a kannel SMS gateway on my FreeBSD 7.2 - the service works great.

I'm now trying to setup a email2sms feature. For this i have created a system user called kannel and all mails are forwarded to this user.

In the home dir of kannel i have the following files.

-rw-r--r--  1 kannel  kannel    81B 17 jan 09:50 .procmailrc
lrwxr-x---  1 root    kannel    58B 14 jan 13:24 email2sms.php @ -> some-what-some-where
-rw-rw-rw-  1 root    kannel   5,8K 17 jan 09:52 log.email2sms
-rw-------  1 kannel  kannel   1,3K 17 jan 09:50 procmail.log
-rw-r-----  1 root    kannel   606B 14 jan 13:28 rawmail.txt

The file email2sms.php is a symlink to the a php script (ZendFramework Application) that takes the email from STDIN, and uses ZendFramework to parse that mail into an object. It then do a http request to the SMS gateway. The php-script works.

Content of .procmailrc

LOGFILE=$HOME/procmail.log
VERBOSE=yes

:0
| php email2sms.php >> log.email2sms

From last sent email i have this in procmail.log

procmail: [97744] Mon Jan 17 09:50:40 2011
procmail: [97744] Mon Jan 17 09:50:40 2011
procmail: Assigning "LASTFOLDER= php email2sms.php >> log.email2sms"
procmail: Executing " php email2sms.php >> log.email2sms"
procmail: Notified comsat: "kannel@:/home/user/kannel/ php email2sms.php >> log.email2sms"
From [email protected]  Mon Jan 17 09:50:40 2011
 Subject: asdf as
  Folder:  php email2sms.php >> log.email2sms                              2600

But there is no new output to log.email2sms, and the script should output the subject of the email.

If i sudo as the kannel user and pipe a file with raw email to the script, it executes just fine.

[root@webserver /home/user/kannel]# /home/user/kannel/ sudo -u kannel cat rawmail.txt | php email2sms.php >> log.email2sms

And the command outputs to log.email2sms as desired.

Any ideas guys?

© Server Fault or respective owner

Related posts about php

Related posts about freebsd