I’m a bit stumped on this one. I’ve got a procmailrc file:
that pipes to a perl script:
Send filename to PHP script for parsing
$exit_status = system("/path/to/php -q /path/to/script/phpMailHandler.php testfile.txt");
Open the log
open (THEFILE, “>> incomingPerlLog.txt”);
Get the current date and time
$theTime = localtime;
Write the log entry
print THEFILE “$theTime: Incoming Mail recieved. \n”;
If I call it from the commandline (perl perlMailHandler) it works, no problem. But when the procmailrc pipes to it on an incoming mail, it won’t write to the file. I also have it calling a php script and passing a fake filename. The PHP file also writes to a log file. And this works on an incoming email. There is also a logfile for procmailrc and it shows perlMailHandler being executed without error. So I know the perl script is being called and completing.
Why wouldn’t the perl script append to a file on an incoming pipe from procmailrc but do it just fine when called from command line??