Email to (PHP) script


#1

Hi,
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])

[1] http://wiki.dreamhost.com/Shell-linked_E-mail
[2] http://wiki.dreamhost.com/Associate_an_Email_Address_with_a_User_with_Shell_Privileges (points to the page above)
[3] http://wiki.dreamhost.com/Email_to_Script (obsolete)


#2

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.