postfix execute external command on every new email
edit /etc/postfix/master.cf
smtp inet n - - - - smtpd -o content_filter=my_scripts:
my_scripts unix - n n - - pipe
flags=Xhq user=username argv=/usr/bin/php /my_scripts.php
X - perform final delivery
h - set the domain & recipient to lowercase
q - quote white space & other special characters
more info
incoming mail and php
setup postfix to forward incoming email to php