What do I need to parse incoming emails?

My intention is to parse incoming emails with PHP. What would be the simplest way to set this up?

Would it suffice to rely on Postfix for this, or is there a better alternative?

The purpose of the parsing is to extract links from incoming emails and store them in the database.

My question is - how can I go about pulling the incoming emails and reading them with another application or script?

*Running Debian


Solution 1:

Set up a pipe alias in /etc/aliases that will send the incoming emails to your script:

sendemailhere: |/path/to/script.php

The email itself will be readable from stdin.