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
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.
LOGFILE=$HOME/procmail.log VERBOSE=yes :0 | php email2sms.php >> log.email2sms
From last sent email i have this in
procmail:  Mon Jan 17 09:50:40 2011 procmail:  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 firstname.lastname@example.org 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.
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?
I changed the phpscript to just
die('bail me out scotty'); and the script executes from .procmail when sending an email. The file
log.email2smsis appended with the bail text.
So perhaps the content of the mail is not corectly piped over or the Zend Framework class that handles the piped data from STDIN is buggy.