Email to (PHP) script


I want to send incoming emails to a PHP script for processing. I could write a PHP script that checks an IMAP account and set up a cron job, but I’d rather instantly pipe incoming emails to a script to so I don’t have to hammer the mail server.

In the Panel I’ve gone to Mail > Message Filters and set up forwarding to a shell account. (see [1], [2]) Where does the email end up? Is it stored in some spool file you have to check periodically or could I just create a .forward.postfix? (see [3])

[2] (points to the page above)
[3] (obsolete)


What exactly is it that you would like me to clarify?

When an email is received instead of it ending up in an email inbox that I have to poll periodically I would like the email to be sent to a script (eg. incoming.php) where I can access it as a variable.

Fetching email with a custom script and a cron job is not as fast or efficient as the .forward.postfix solution, if it works.