Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question
    
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

2 Answers 2

up vote 3 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.

share|improve this answer

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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