I have a procmail recipe that takes the body of a mail and sends it to a php script. However, procmail complains with an error.
Here is how it works:
The user that needs access to hardware parameters has to register via e-mail like this:
Subject:Register
Body:??username:email_address:password??
Procmail then sends the body off to the php script to be processed. The reason I use "??" is to make it easier for me to filter out the garbage of what comes with the body via grep.
Here is the error in procmail.log:
From fetchmail Fri Nov 25 15:41:36 2016
Subject: Register
Folder: /root/mail/inbox/inbox 3673
procmail: [20601] Fri Nov 25 15:43:44 2016
procmail: Assigning "DEFAULT=/root/mail/inbox/inbox"
procmail: Assigning "PMDIR=/root/.procmail"
procmail: Match on "^Subject.*[R|r]egister$"
procmail: Executing "/usr/bin/php,-f,/root/data/scripts/register.php"
procmail: Executing "??myusername:me@gmail.com:mypass1??"
/bin/sh: 0: Can't open ??myusername:me@gmail.com:mypass1??
Here is my procmail recipe:
SHELL=/bin/sh
HOME=$HOME
PATH=$HOME/bin:/usr/local/bin:/usr/bin:/bin:/sbin:/usr/sbin
SENDMAIL=/usr/sbin/sendmail
MAILDIR=$HOME/mail
LOGFILE=/var/log/procmail.log
LOGABSTRACT="all"
VERBOSE="on"
DEFAULT=$HOME/mail/inbox/inbox
PMDIR=$HOME/.procmail
:0
* ^Subject.*[R|r]egister$
{
:0 bf
| `/usr/bin/php -f /root/data/scripts/register.php`
}
Here is an abbreviated snippet of the register.php script:
#!/usr/bin/php
<?php
while ( false !== ( $user_register = fgets ( STDIN ) ) )
{
$user_info = preg_match ( "/\?\?.*\?\?/", @$user_register, $new_registration ) ;
foreach ( $new_registration as $input )
{
print ( $input."\n" ) ;
}
}
I do not think it has anything to do with the php code as I have similarly structured recipes and php code.
Any pointers?