lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Sep 18, 2011, at 10:54 PM, Alex Marinko wrote:

> a bizarre idea came to my mind: instead of relying on an email client,I would like to construct my own email system

Short version: mad as a hatter :P

In other news, by an amazing coincidence, I just started the process of concocting some sort of IMAP server :)

As Sean Conner highlighted, there are a couple of gotchas you need to take care of.

(1) Email parsing

Three broad possibilities:

(1.1) Write your own. Not impossible, but finicky and error prone [1]. This will test you patience and may drive you mad.
(1.2) Reuse an existing library, such as VMime [2], GMime [3] or such. Need biddings. May be more than you bargained for.
(1.3) Ignore the issue and farm out the problem to a third party such as D. J. Bernstein's mess822 and maildrop's reformail/reformime

(2) Charset

If you are lucky, solving (1)  might solve (2).

If not, you may want to look into something like iconv or such. You might also need to decode the email header themselves, e.g. '=?iso-8859-1?Q?H=F3la!?=' into 'Hóla!'

(3) Persistency

Files? DB? Both? Something else? How do you identify messages? Do you want to make them unique? How? Concurrency? Canonical vs. raw? Search? Etc, etc... questions, questions, questions... no universal answers as this really depends of what you are trying to achieve.

And all that is even before you start doing anything useful in your own program :)

Best of luck! :))

[1] http://dev.alt.textdrive.com/browser/HTTP/MIME.lua
[2] http://www.vmime.org/
[3] http://spruce.sourceforge.net/gmime/
[4] http://cr.yp.to/mess822.html