tags:

views:

43

answers:

1

I have a web app that create groups. Each group gets their own discussion board.

I would like to add the feature of allowing users to send emails to their "group" within the web app to start a new discussion or reply to an email from the "group" to make a new post in an already ongoing discussion.

For example, to start a new discussion a user would send:
From: [email protected]
To: [email protected]
Subject: Hey guys! Meet up on Tuesday?
Body: Yes? No?

All members of the group would receive an email:
From: [email protected]
Subject: Hey guys! Meet up on Tuesday?
Body: Yes? No?
Reply-To: group1@ example.com

And, the app would start a new discussion with:
Author: Bill Fake
Subject: Hey guys! Meet up on Tuesday?
Body: Yes? No?

This is a pretty standard feature for Google Groups and other big sites. So how do us mere mortals go about implementing this? Is there an easy way?

Or do I:
1. Install postfix
2. Write scripts to create new accounts for each new group
3. Access the server periodically via pop3 (or imap?) to retrieve the email messages sent to each account?
4. Parse the message for content

If it's the latter, did I miss a step?

+1  A: 

Configure your mail server to run on a database backend (such as MySQL), then you can just insert records from your app to create mail accounts.

I'm not sure if you can make it deliver messages into a MySQL table as well. You might need to access it via IMAP, or perhaps just access the Maildirs directly with Python's Maildir support.

The advantage of IMAP though, is that you could use IMAP notify to save some polling. But I suppose you could use inotify (or something similar) for Maildirs as well.

Since you're using Python, I also recommend taking a look at Lamson. Maybe look into mailman since what you're doing sounds vaguely mailinglistish (but I've heard horror stories about mailman).

Ycros
I added a comment to specify my language and framework. Sorry I didn't mention it. I've found Lamson before, but I'm concerned about using a relatively small, obscure email server: Google doesn't have nearly as much on Lamson as it does on Postfix; and my needs are not massive, but decent (rough estimate of 50k inbound, 300k outbound emails per day). If I ever have to scale, I want to know I'll be able to using a server that has done it before. Thanks for the suggestion though.
cadwag
Okay, I've just expanded on my answer a bit. I agree that lamson is not as battle hardened, however it does seem to be the nicest/easiest way of messing with email. I'll certainly seriously consider it if I ever do a project involving email.
Ycros
I'm starting to think you have a point. As suggested in the Lamson FAQ, I could use Lamson for messing with inbound emails and use Postfix for the heavy lifting on the outbound. I'll def look into it more. Thanks again for the suggestion.
cadwag