Create a link between email and my web app?

I've seen on a site like flickr or brightkite, personal email is provided to users. If a user sends a message to someone at this address, the content is posted to their public profile. How can I do this in a web app?

+1


source to share


4 answers


Flickr published its methods for this in Building Scalable Websites. Topic Chapter 6 deals with this topic. You don't need a custom MTA like above. MTAs will work fine by default (sendmail, qmail, postfix, exim, etc.). All you have to do is edit /etc/aliases./etc/aliases can be used to set the mailbox to transfer all email to the script.



I highly recommend reading this chapter as it outlines many of the common problems that you will encounter, such as syntax attachments, handling email from mobile devices (which often includes bad / dodgy headers), correct authorization, etc. etc.

0


source


There are two ways to do this as I see it:

First, you can use your existing SMTP / email server system and during the interval pull messages from that mailbox using POP3 or IMAP to insert stuff into your database / system.

Alternatively, you can write an SMTP implementation that will accept incoming emails and execute your own logic to put the data in your database / system rather than in the mailbox. This is ultimately a cleaner design that has much less overhead. In fact, there might be an implementation of an SMTP server out there somewhere, allowing you to inject logic like this (I'll edit if I find it).

Personally, I would go with the second option. This will give you a lot more control over what is happening on your system and it will have an overall design.



Good luck!

Edit: It's not PHP, but JAMES from Apache is a Java mail server that allows you to inject custom mail processing modules (called mailets) to handle mail. You can write a malet that will process email messages and push updates to your database instead of your mailbox. There may be other projects that implement this kind of design, so it's worth a look.

Edit again: Ooo ... here's an open source php SMTP server at SourceForge. I don't know that you can inject custom logic, but you can always edit the source code and make it do what you want! (If you insist on PHP anyway)

+4


source


+1


source


There are several free mail servers out there that support MySQL or any other database as storage and only require configuration to do so. If you don't like setting up an existing mail server or writing yourself, I would go with this solution. This is orders of magnitude faster than using POP3 or IMAP to communicate with the mail server.

+1


source







All Articles