views:

60

answers:

2

I am looking to create an incoming email daemon switchboard that I can integrate with various remote php/mysql apps. Ideally I want to check the 'to' address to see if it is in a mysql database and if it is, have the email parsed and posted via CURL to a target destination as well as have attachments saved somewhere locally.

I will likely set up a rackspace cloud server dedicated to this task (just accepting emails and posting to 3rd party APIs). However, I do not know where to start. Which server platform / distribution should I go with? Which software needs to be customized, etc?

Update: I am not looking for a full solution or tutorial, I just would like some advice on a good starting point as Linux software is not my forte.

+1  A: 

You're going to have two pieces with this project: The mail server and the mining application:

Mail Server:

  • The easiest way to get started with this is have your mail sent to something like gmail. Then, use gmail's read functionality (probably through one of the several thrid party gmail apis) to get the message. You don't have to use gmail for this piece, obviously, but it might be a good way to get started.

Mining app: Once you can read mail you need to do two major tasks here:

  • Track the messages: Keep track of messages you've already mined. This probably is not as simple as "I've already looked at everything before this date."
  • Mine it: Use a regex to see if the message has the term you're looking for. If it does, send an HTTP post (via CURL as you suggested) to your service that takes these things and dumps them in a DB (or whatever you want to do with them.)
labratmatt
using gmail is interesting but then wouldn't I have to constantly poll gmail to check for new mail? I am more interested in a "push" approach.
phirschybar
+2  A: 

you can use procmail to fire up your application as soon as mail has been received google for procmail recipes

bumperbox