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

link|improve this question

70% accept rate
What outcome are you trying to achieve? Please provide more information about why you would like to parse the e-mail messages and what you want to happen as a result of parsing the e-mail messages. – Convict May 10 '10 at 7:14
If you're wanting assistance for the programming side (PHP is an odd choice) you would be better off on Stack Overflow. – John Gardeniers May 10 '10 at 7:19
I would assistance in understanding how I can pull out the emails, i.e. where they are stored and how I can read them by another application. – Miko May 10 '10 at 7:27
feedback

2 Answers

up vote 1 down vote accepted

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.

link|improve this answer
feedback

Since this is being referenced from other questions as a duplicate.....

I'd recommend considering handling the redirection using an MDA rather than as an MDA. This gives a lot more flexibility. E.g. you can easily set up procmail to filter bounced messages, autorespond to incoming messages, forward a copy to a mailbox and send the email to a script. And it can be managed without root access.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.