trigger a php script when an email is received

The easiest way by far will be using the dot-qmail configuration files for every mailbox you want to to invoke your script for. You can read about dot-qmail here and the enviromental parameters you can use in qmail-command


So the answer is procmail. As I'm not a qmail guy I can't tell you how you integrate it into qmail. But probably the answer is here.

Then you need a recipe to trigger the program and after that deliver the mail as before. The complete documentation is also online available:

  • http://servers.digitaldaze.com/extensions/procmail/manpages/procmail.1.html
  • http://servers.digitaldaze.com/extensions/procmail/manpages/procmailex.5.html
  • http://userpages.umbc.edu/~ian/procmail.html
  • http://cr.yp.to/qmail/faq/incominguser.html
  • and many many more

Procmail is ancient (but robust!) software. We still use it to do Spam filtering (yes, indeed) for about 500,000 mails daily.