I’m trying to forward email to a PHP script using a pipe. I want the PHP script to read the email and store the messages in a text file.
I read a bunch of forum posts here and tried following DreamHost’s wiki. Here’s what I got so far:
In my root directory, I have a .forward.postfix file with 1 line:
“|/usr/bin/procmail”
Also in my root directory, I have a .procmailrc file, with some code:
DEFAULT=$HOME/Maildir/
MAILDIR=$HOME/Maildir
PMDIR=$HOME/.procmail
LOGFILE=$PMDIR/log
SHELL=/bin/sh
LD_LIBRARY_PATH=/usr/local/php5/lib/php
PHP=/usr/local/php5/lib/php
:0
- ^TO_myemail@mysite.net
|$PHP -q /home/myusername/mysite.net/log.php
I tried sending an email to myemail@mysite.net, but log.php didn’t write anything in the log.txt file.
So my question is: What do I do now?
Does the .procmailrc file have an error? I don’t think my log.php has an error, but I will post the code if anyone wants to see it.