I'm trying to figure out how I can forward (or pipe) an email to a PHP script using fetchmail. I've never done this and am not even sure if I'm on the right track. From what I've read I think I need to use an MDA to forward the mail. I'm using procmail as my MDA.
Here is my fetcmailrc file
set daemon 150
set logfile /local/web/sites/sitename/mail/fetchmail.log
poll blahblah with proto IMAP
user Username there with password userpassword is Username here
ssl
fetchall
no rewrite
mda "/usr/bin/procmail -d Username -f %F -d %T $HOME/.procmailrc";
Here is my procmailrc file. You can see at the bottom I'm trying to pipe the email to a PHP script.
SHELL=/bin/csh
DEFAULT=/var/mail/Username/
MAILDIR=/var/mail/Username/
:0
! `/usr/local/bin/php -f /local/web/sites/stack/htdocs/bin/catchmail.php`
I run fetchmail and the fowarding (piping to PHP) doesn't work. My fetchmail.log says:
procmail: Insufficient prvileges
procmail: Unknown user
Any pointers? Am I even headed in the right direction?