5

I am developing a website -- in the prototype stage, soon to be alpha. I will provide an email address to each account that allows the user to deposit stuff -- not a real email account, just an endpoint for sending things to the site. Many sites provide this kind of service nowadays. I think the first one I saw was Photobucket, which let's you send photos as email attachments.

My question is, what is the best way to implement this kind of service?

In my prototype, I have written a POP3 client which fetches all newly delivered mail (currently from a test Gmail account). My service processes each new mail and attachments, and immediately removes it from the email server.

I could certainly outsource to an email service with POP3 and be done with it. The problem is cost. Most services I have seen provide much more than I need, and they charge per account. I expect to have many accounts and low traffic volume.

So I'm leaning towards hosting email receipt myself. I am open to Windows or Linux. The code that processes incoming emails runs on Windows, but I have other services running on Linux. I have seen a number of open source and free email servers, such as hMailServer and MailEnable (Windows) and qmail, Postfix and exim (Linux).

I guess I have a slight preference towards Linux because of lower hosting costs, but if a Windows service can provide cleaner integration, that might be worth it. As far as features, I would like to have some spam filtering, but it's is not a huge priority. POP3 is adequate for retrieval, but a more direct API would be nice. I will need some kind of API for programmatically provisioning new accounts.

All suggestions are appreciated. Do you know how others implement this kind of service?

UPDATE: I ended up using hMailServer, which is a free mail server that runs on Windows. It seems to be quite mature and robust. It has a COM interop library which makes accessing emails, accounts, etc. from my .NET server app very easy indeed.

Kara
  • 6,115
  • 16
  • 50
  • 57
Tim Scott
  • 15,106
  • 9
  • 65
  • 79
  • Thanks! I'm looking to do almost the exact same thing and was considering hMailServer. You've helped confirm that it will work for me. – Darryl Jul 12 '11 at 21:48
  • Hey Tim, any tips on using hMailServer for that purpose? I am about to do the same exact thing... – richard Nov 17 '13 at 23:19
  • @RichardDesLonde Not really. My site never really launched, and I'm totally out of the Windows world. If I recall, it seemed to work pretty well and fit the bill. I would also note that it's been 2.5 years, so you should look around and see what's state of the art today. – Tim Scott Nov 18 '13 at 05:12
  • Thanks Tim. Sorry to hear about your website. I'm considering Exchange with EWS as well... – richard Nov 18 '13 at 05:56

3 Answers3

1

If you're going the host-your-own-email-server route, I would probably just use POSTFIX and pipe all your email to a PHP script, which processes the email.

Here's a quick'n dirty tutorial on setting up the email pipe if you're using cPanel:

http://kb.siteground.com/article/How_to_pipe_an_email_to_a_PHP_script.html

If not, here's how to do it:

http://answers.google.com/answers/threadview?id=562518

Jesse Bunch
  • 6,651
  • 4
  • 36
  • 59
  • Thanks for the response. As I mentioned, emails are processed on Windows (.NET). I'm bit of a Linux noob and I have zero PHP knowledge. Is you suggestion of piping to PHP some intermediate step to get it to my .NET program? – Tim Scott Mar 27 '11 at 20:00
  • Here is how to pipe in IIS 7: http://stackoverflow.com/questions/926345/pipe-incoming-email-to-a-script-on-windows-iis-smtp – Jesse Bunch Mar 27 '11 at 20:04
1

The bottom line is, you need to have an open SMTP connection to accept email. If you have your own server, then you can install a SMTP server on the machine. Usually, you have filesystem access to the location the email files are placed. Be sure to select a SMTP server that allows this, and that the email are in a format that you can parse.

Then, you can just monitor the file location for incoming emails.

If you can't pipe your emails (using the Postfix suggestion), and you don't have your own server (for example, on a shared hosting plan), then you will need to query a POP3 or IMAP mailbox server for your emails, and parse them accordingly.

dave wanta
  • 7,164
  • 3
  • 29
  • 29
0

I wanted to get emails in real time so I worked out my own solution with google app engine. I basically made a small dedicated google app engine app to receive and POST emails to my main site. That way I could avoid having to set up an email server.

You can check out Emailization (a little weekend project I did to do it for you), or you this small GAE app that should do the trick.

I kinda explained it more on another question.

Hope that helps!

Community
  • 1
  • 1
Capitao
  • 285
  • 3
  • 3
  • 1
    While we understand your enthusiasm, posting the same basic answer to multiple questions, with all of them promoting one product of yours, is not really the best way to go at this. If these questions are all really similar, flag them to be closed as duplicates of one core question. Otherwise, try to craft individual responses to each of the questions you're answering. – Brad Larson Jul 17 '12 at 04:14