Homemade email system using LuaSocket and LuaPOP3

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
37 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Homemade email system using LuaSocket and LuaPOP3

Alex Marinko
Hi,

a bizarre idea came to my mind: instead of relying on an email client,
I would like
to construct my own email system by assembling together existing code
(LuaSocket,
LuaPOP3, etc). It would not be a full fledged email client (and
probably would have
only a very limited, text-based UI, at best). Something along the
lines of Mail Handler.
I would need it for ordinary email operations, nothing complex. And IMAP4 is
not needed at all.

The idea would be to reproduce, in Lua, something similar to Mail Handler, but
probably much simpler.
As far as I know, no such system has been constructed in Lua yet
(please correct
me if I am wrong), but from what I understand it would not be too
difficult to put it
together starting with Lua programs which provide SMTP and POP3
functionalities.
Once cobbled together, I would be running an email system similar to
Mail Handler and nmh.

Could you please give me some suggestions as to the best way to implement such
a system (possibly, by storing each email as a separate file on the disk)?
Would it be very difficult to put together, starting from the
components already available?
Is anyone interested in such a system? Anyone willing to cooperate?
Any ideas will be appreciated.

Thank you

Alex

Reply | Threaded
Open this post in threaded view
|

Re: Homemade email system using LuaSocket and LuaPOP3

Sean Conner
It was thus said that the Great Alex Marinko once stated:

> Hi,
>
> a bizarre idea came to my mind: instead of relying on an email client, I
> would like to construct my own email system by assembling together
> existing code (LuaSocket, LuaPOP3, etc). It would not be a full fledged
> email client (and probably would have only a very limited, text-based UI,
> at best). Something along the lines of Mail Handler. I would need it for
> ordinary email operations, nothing complex. And IMAP4 is not needed at
> all.
>
> The idea would be to reproduce, in Lua, something similar to Mail Handler,
> but probably much simpler. As far as I know, no such system has been
> constructed in Lua yet (please correct me if I am wrong), but from what I
> understand it would not be too difficult to put it together starting with
> Lua programs which provide SMTP and POP3 functionalities. Once cobbled
> together, I would be running an email system similar to Mail Handler and
> nmh.
>
> Could you please give me some suggestions as to the best way to implement
> such a system (possibly, by storing each email as a separate file on the
> disk)? Would it be very difficult to put together, starting from the
> components already available? Is anyone interested in such a system?
> Anyone willing to cooperate? Any ideas will be appreciated.

  The hardest part, by far, will be actually parsing the email messages,
especially headers [1] that contain email addresses (like From:, To:, Cc:,
etc.).  I've been playing around with this for the past few years (not even
part time---basically, when I have *nothing* else to do, which is why it's
taken a few years) and I *think* I finally have a handle on it.  For
instance:

From: Sean Conner <[hidden email]>, (Sean Conner) <[hidden email]>,
        [hidden email] (Sean Conner), [hidden email], "Sean (I Am A
        Programmer)" Conner <sean(that's me)@conman(my domain) . com>

  All of those are valid email addresses.  Okay, a few are pathological
but are quite possible (theoretically; probably never in practice).  Second
hardest (especially for older email) is Date:---you would not believe the
crap I've seen in that header.  I've even come across problematic Message-ID
headers (and about 20% of email I have doesn't have a Message-ID header).

  Second hardest issue about email is the use of character sets.  Most
contain the proper character set in use, but that still leaves plenty where
you have to guess at the set being used (not to mention the ones that don't
bother using US-ASCII in the headers---technically not allowed but hey, I
have plenty of emails that break that particular part of the standard).  

  Now, with that out of the way, a decent method of storing emails is one
per file, and there's even a semi-standard for that [3].  My preference is
to take the Message-ID (if it doesn't exist, generate one), take a hash
(SHA1, MD5, pick your favorite) and use that result as the basis for the
directory/filename.  I also store two versions of the headers and the body
as separate files.  For example:

        Message-ID: <[hidden email]>

  This (I include the brackets since it's part of the message id) hashes to
(I use MD5 since it was handy):

        fff6c8c5b7ae790d732d6cf50b8a5ff6

  I then break the hash up into three components:

        fff6 c8c5 b7ae790d732d6cf50b8a5ff6

  The first two components become directories (I've found that too many files
in a single directory has performance issues) and the third the basis for
the filename.  The base filename becomes the third portion of the hash plus
the message ID (sans the brackets):

        b7ae790d732d6cf50b8a5ff6,[hidden email]

  I do this in case two email message IDs hash to the same value.  With that,
I create three files per email, the body, and two for headers.  The first
one for headers only contains the From:, To:, Date: and Subject: headers,
which for me, are typically the only ones I'm insterested in (say, for
displaying purposes).  The other headers file contains the full set of
headers.  So, this method creates:

        fff6/c8c5/b7ae790d732d6cf50b8a5ff6,[hidden email],B
        fff6/c8c5/b7ae790d732d6cf50b8a5ff6,[hidden email],HF
        fff6/c8c5/b7ae790d732d6cf50b8a5ff6,[hidden email],HS

        ,B = body of email message
        ,HF = full headers
        ,HS = From:, To:, Subject:, Date: headers only

  For "folders" of email, I use a text file that contains message IDs of
emails for that "folder".  The upside---an email message can be in multiple
"folders" while maintaining a single copy of the email.  The downside---I
need to track the "folders" an email is in (probably with the use of another
header, but I haven't gotten that far yet).  

  It works for me (and I have a ton of personal email and USENET messages
dating back to the early 90s).  

  -spc (And quite a bit of this work has been done with Lua code I wrote [4])
 
[1] RFCs for email headers:

        RFC-822 earliest currently used standard [2]
        RFC-1036 USENET headers---may be of some use to email
        RFC-2045 MIME headers
        RFC-2046
        RFC-2047
        RFC-2048
        RFC-2049
        RFC-2369 Mailing list headers
        RFC-2822 update of RFC-822
        RFC-2919 List-ID
        RFC-5064 Archived-At header
        RFC-5322 update of RFC-2822

[2] The RFCs leading up to RFC-822:

        RFC-0561
        RFC-0680
        RFC-0724
        RFC-0733

[3] mdir format.

[4] Except for the header parsing---for that I use C code, and I'm still
        working on that.


Reply | Threaded
Open this post in threaded view
|

Re: Homemade email system using LuaSocket and LuaPOP3

Petite Abeille
In reply to this post by Alex Marinko

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



Reply | Threaded
Open this post in threaded view
|

Re: Homemade email system using LuaSocket and LuaPOP3

Petite Abeille
In reply to this post by Sean Conner

On Sep 19, 2011, at 12:33 AM, Sean Conner wrote:

> I create three files per email, the body, and two for headers.

How do you deal with multipart? Are they all bunches together in ,B?


Reply | Threaded
Open this post in threaded view
|

Re: Homemade email system using LuaSocket and LuaPOP3

Tim Caswell
I don't know much about lua's standard network API's, but I'm working on binding to libuv (the network layer in nodeJS) to LuaJIT. <https://github.com/creationix/luanode>

 It's still a ways off, but it should make building the network half of such servers really easy.  Any parser logic can be shared as long as it's implemented to not do I/O itself.

On Mon, Sep 19, 2011 at 11:03 AM, Petite Abeille <[hidden email]> wrote:

On Sep 19, 2011, at 12:33 AM, Sean Conner wrote:

> I create three files per email, the body, and two for headers.

How do you deal with multipart? Are they all bunches together in ,B?



Reply | Threaded
Open this post in threaded view
|

Re: Homemade email system using LuaSocket and LuaPOP3

Petite Abeille

On Sep 19, 2011, at 8:12 PM, Tim Caswell wrote:

> I don't know much about lua's standard network API's,

There is none., but LuaSocket is the closest to it:

http://w3.impa.br/~diego/software/luasocket/

But not necessarily suited for server side application. YMMV.

> but I'm working on
> binding to libuv (the network layer in nodeJS) to LuaJIT. <
> https://github.com/creationix/luanode>
>
> It's still a ways off, but it should make building the network half of such
> servers really easy.  

Or one could outsource the entire networking part to something like tcpserver [1] or such.

On the other hand, sometime it's not so straightforward to decouple the networking from the protocol itself (e.g. STARTTLS). Sigh.

> Any parser logic can be shared as long as it's
> implemented to not do I/O itself.

Well, a parser need to read some input, write some output, manipulate the network connection.

[1] http://cr.yp.to/ucspi-tcp/tcpserver.html
Reply | Threaded
Open this post in threaded view
|

Re: Homemade email system using LuaSocket and LuaPOP3

Sean Conner
In reply to this post by Petite Abeille
It was thus said that the Great Petite Abeille once stated:
>
> On Sep 19, 2011, at 12:33 AM, Sean Conner wrote:
>
> > I create three files per email, the body, and two for headers.
>
> How do you deal with multipart? Are they all bunches together in ,B?

  I haven't implemented MIME support, so they're all in ,B for now.  

  -spc (It really is a low-priority project for me 8-)



Reply | Threaded
Open this post in threaded view
|

Re: Homemade email system using LuaSocket and LuaPOP3

Dirk Laurie
In reply to this post by Petite Abeille
On Mon, Sep 19, 2011 at 08:03:58PM +0200, Petite Abeille wrote:
>
> On Sep 19, 2011, at 12:33 AM, Sean Conner wrote:
>
> > I create three files per email, the body, and two for headers.
>
> How do you deal with multipart? Are they all bunches together in ,B?
>
>
That's easy to implement if you have already have a parser that gives
a table `headers` and a string `body`, e.g. the one in stdlib which
is basically the same as the one on LuaWiki.  See attachment.

If the message is multipart, then `headers['content-type']` looks like this:

    multipart/mixed; boundary="_8b46a2bf-7207-48f7-b891-529cc7393c5c_"

That boundary, preceded "--", occurs on the lines that separate
the message into parts.

After that, it's recursive.

`lua5.1 mboxdemo.lua test.mbox` gives this output:

    This mailbox has 1 message
    message 1 has 5 parts
    part 1 has 2 parts
        1: length=965,  text/plain; charset="iso-8859-1"
        2: length=2800,  text/html; charset="iso-8859-1"
      2: length=551688,  application/pdf
      3: length=960,  text/plain
      4: length=143868,  application/msword
      5: length=18325,  image/pjpeg

Sorry, unlike the code, test.mbox contains copyrighted material.

For a reason that I still have to find, `lua5.2 mboxdemo.lua test.mbox`
does not work.

Dirk


mboxparser.lua (1K) Download Attachment
mboxdemo.lua (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Homemade email system using LuaSocket and LuaPOP3

Stefan Reich
I'd just like to add that this is an interesting discussion to come up just now.

I was - or actually, I still am - considering writing an email client
as one of the first real-world Lua OS apps.

If someone has working Lua code for the non-UI part (POP3/message
parsing), I'll be glad to port that to Safe Lua, add a little GUI
and... voila: world domination.

-Stefan

Reply | Threaded
Open this post in threaded view
|

Re: Homemade email system using LuaSocket and LuaPOP3

Louis Mamakos

On Sep 20, 2011, at 4:45 PM, Stefan Reich wrote:

> I'd just like to add that this is an interesting discussion to come up just now.
>
> I was - or actually, I still am - considering writing an email client
> as one of the first real-world Lua OS apps.
>
> If someone has working Lua code for the non-UI part (POP3/message
> parsing), I'll be glad to port that to Safe Lua, add a little GUI
> and... voila: world domination.
>
> -Stefan
>

Many years ago, I crawled around the inside of MH and NMH; it might be worth
looking at that code to see what can be reused for the grunt work of parsing
messages, etc.  As I recall, the code was partitioned into a subroutine library
distinct from the dozen or so user programs for manipulating local folders.

The message parsing code was quite robust, having been tested by time, and
pretty well optimized since the code spent most of it's time puzzling over
RFC-822-style headers, and more so with MIME body parts.  You don't want to
learn all those lessons the hard way, again.

Of course, MH/NMH (at least back then) didn't speak network, so you're still
left with that problem.

Louis Mamakos


Reply | Threaded
Open this post in threaded view
|

Re: Homemade email system using LuaSocket and LuaPOP3

Jeff Pohlmeyer
In reply to this post by Alex Marinko
On Sun, Sep 18, 2011 at 3:54 PM, Alex Marinko wrote:


> I would like to construct my own email system by assembling
> together existing code

A few years back somebody who went by the name "darkgod" had written
a SMTP server in Lua. I managed to track down the website, but it
seems to have a lot of broken links, including the link to the source
code. This is about as close as I could get:

  http://net-core.org/category/tethys

I think the author might be hanging out here now:

  http://te4.org/blogs/darkgod

 - Jeff

Reply | Threaded
Open this post in threaded view
|

Re: Homemade email system using LuaSocket and LuaPOP3

clemens fischer
In reply to this post by Sean Conner
Sean Conner wrote:

> ...
>  Now, with that out of the way, a decent method of storing emails is one
> per file, and there's even a semi-standard for that [3].  My preference is
> to take the Message-ID (if it doesn't exist, generate one), take a hash
> (SHA1, MD5, pick your favorite) and use that result as the basis for the
> directory/filename.  I also store two versions of the headers and the body
> as separate files.  For example:
>
>        Message-ID: <[hidden email]>
>
>  This (I include the brackets since it's part of the message id) hashes to
> (I use MD5 since it was handy):
>
>        fff6c8c5b7ae790d732d6cf50b8a5ff6

According to RFC-5322 a "Message-ID" contains the string including the
angle brackets.  I say that because here (in bash):

  $ md5sum <<< '<[hidden email]>'
  96a8888ea961b869c85919526e0ac48b  -

Including the header name "Message-ID:" and any possibly folding white
space will pose a problem when looking up ID's mentioned in
"References:" or "In-Reply-To:" headers.

> ...
>  I then break the hash up into three components:
>
>        fff6 c8c5 b7ae790d732d6cf50b8a5ff6
>
>  The first two components become directories (I've found that too many files
> in a single directory has performance issues) and the third the basis for
> the filename.  The base filename becomes the third portion of the hash plus
> the message ID (sans the brackets):
>
>        b7ae790d732d6cf50b8a5ff6,[hidden email]
>
>  I do this in case two email message IDs hash to the same value.  With that,
> I create three files per email, the body, and two for headers.  The first
> one for headers only contains the From:, To:, Date: and Subject: headers,
> which for me, are typically the only ones I'm insterested in (say, for
> displaying purposes).  The other headers file contains the full set of
> headers.  So, this method creates:
>
>        fff6/c8c5/b7ae790d732d6cf50b8a5ff6,[hidden email],B
>        fff6/c8c5/b7ae790d732d6cf50b8a5ff6,[hidden email],HF
>        fff6/c8c5/b7ae790d732d6cf50b8a5ff6,[hidden email],HS
>
>        ,B = body of email message
>        ,HF = full headers
>        ,HS = From:, To:, Subject:, Date: headers only
>
>  For "folders" of email, I use a text file that contains message IDs of
> emails for that "folder".  The upside---an email message can be in multiple
> "folders" while maintaining a single copy of the email.  The downside---I
> need to track the "folders" an email is in (probably with the use of another
> header, but I haven't gotten that far yet).

In leafnode (the small usenet server) this is solved using separate
directories handled in a similiar way.  The Message-ID's are hashed and
there's a directory spool/news/message.id/XXX/ containing entire
articles.  "XXX" is a hash bucket named with three decimal digits.

The "folders" (usenet newsgroups) contain hard-links providing the
mapping between articles and possibly several newsgroups an article may
have been crossposted to.

This solves the "an email message can be in multiple "folders" while
maintaining a single copy" problem while no separate database (your text
file index) is needed.  It is way simpler to make tools handling links
than to keep a database.

> ...
> [4]     Except for the header parsing---for that I use C code, and I'm still
>        working on that.

Good luck with [4].  I have frequently tried to catch up with all the
variations of headers in "conforming" emails/articles and, of course,
the spammy ones.  In addition to the ones you mention, here are some
tools doing MIME parsing:

http://www.ivarch.com/programs/qsf/
http://bogofilter.sourceforge.net/

They are possibly more "real world" than the strict ones you refer to,
especially DJB's mess822.


clemens


Reply | Threaded
Open this post in threaded view
|

Re: Homemade email system using LuaSocket and LuaPOP3

clemens fischer
In reply to this post by Petite Abeille
Petite Abeille wrote:

> Or one could outsource the entire networking part to something like
> tcpserver [1] or such.
>
> On the other hand, sometime it's not so straightforward to decouple
> the networking from the protocol itself (e.g. STARTTLS). Sigh.
>
>> Any parser logic can be shared as long as it's
>> implemented to not do I/O itself.
>
> Well, a parser need to read some input, write some output, manipulate
> the network connection.
>
> [1] http://cr.yp.to/ucspi-tcp/tcpserver.html

similiar:

http://smarden.org/ipsvd/index.html


clemens


Reply | Threaded
Open this post in threaded view
|

Re: Homemade email system using LuaSocket and LuaPOP3

Luiz Henrique de Figueiredo
In reply to this post by Louis Mamakos
> Many years ago, I crawled around the inside of MH and NMH; it might be worth
> looking at that code to see what can be reused for the grunt work of parsing
> messages, etc.  As I recall, the code was partitioned into a subroutine library
> distinct from the dozen or so user programs for manipulating local folders.

There is also GNU Mailutils at http://mailutils.org/ which is also built
as a library serving several clients.

Reply | Threaded
Open this post in threaded view
|

Re: Homemade email system using LuaSocket and LuaPOP3

Sean Conner
In reply to this post by clemens fischer
It was thus said that the Great clemens fischer once stated:

> Sean Conner wrote:
>
> > ...
> >  Now, with that out of the way, a decent method of storing emails is one
> > per file, and there's even a semi-standard for that [3].  My preference is
> > to take the Message-ID (if it doesn't exist, generate one), take a hash
> > (SHA1, MD5, pick your favorite) and use that result as the basis for the
> > directory/filename.  I also store two versions of the headers and the body
> > as separate files.  For example:
> >
> >        Message-ID: <[hidden email]>
> >
> >  This (I include the brackets since it's part of the message id) hashes to
> > (I use MD5 since it was handy):
> >
> >        fff6c8c5b7ae790d732d6cf50b8a5ff6
>
> According to RFC-5322 a "Message-ID" contains the string including the
> angle brackets.  I say that because here (in bash):
>
>   $ md5sum <<< '<[hidden email]>'
>   96a8888ea961b869c85919526e0ac48b  -

  Actually, looking over the code (and it's a mess, what with a dozen
half-finished different versions) I'm not sure what I was exactly using for
the hash, but I do know it was consistent at least.

> Including the header name "Message-ID:" and any possibly folding white
> space will pose a problem when looking up ID's mentioned in
> "References:" or "In-Reply-To:" headers.

  The actual message ID appears in angle brackets---anything else is *not*
the message ID (but the header can contain other stuff, not usually, but the
older the email, the more likely it'll be ... um ... interesting).

> >  I then break the hash up into three components:
> >
> >        fff6 c8c5 b7ae790d732d6cf50b8a5ff6

  I found a later version that broke the hash up thusly:

        fff 6c8 c5b7ae790d732d6cf50b8a5ff6

  I did that because the former (with four hex-digits) could lead to
directories with up to 65,536 entries, whereas with the later (three
hex-digits) you would end up with directories with only (only!) 4,096
entries, a figure I find much more managable.

> The "folders" (usenet newsgroups) contain hard-links providing the
> mapping between articles and possibly several newsgroups an article may
> have been crossposted to.
>
> This solves the "an email message can be in multiple "folders" while
> maintaining a single copy" problem while no separate database (your text
> file index) is needed.  It is way simpler to make tools handling links
> than to keep a database.

  But without a separate database (my text file), there is no way of knowing
which "folders" an individual message resides in.  For instance, one can
delete a message from a folder, or one can delete a message form all
folders (and thus, remove it entirely).  

> > ...
> > [4]     Except for the header parsing---for that I use C code, and I'm still
> >        working on that.
>
> Good luck with [4].  I have frequently tried to catch up with all the
> variations of headers in "conforming" emails/articles and, of course,
> the spammy ones.  In addition to the ones you mention, here are some
> tools doing MIME parsing:

  I'm close---I just need to finish doing some rewriting as I changed
directions in the actual parsing (first draft---everything had to be in
memory.  That doesn't work well for handing email as it comes in over the
network, so I needed to handle a stream-based interface, but I didn't want
to lose the ability to handle a memory-mapped email---much rewriting
ensued), as well as further clarification of the various headers (and just
how messed up they can be).  

> http://www.ivarch.com/programs/qsf/
> http://bogofilter.sourceforge.net/
>
> They are possibly more "real world" than the strict ones you refer to,
> especially DJB's mess822.

  I have personal email going back to 1993; I have even older emails going
back to the mid-80s (from archives), so I have plenty of "real world"
examples to go by.

  -spc (also, I found this bug in Lua http://www.lua.org/bugs.html#5.1.4-6
        due to my email project).


Reply | Threaded
Open this post in threaded view
|

Re: Homemade email system using LuaSocket and LuaPOP3

Daniel Hertrich
Hi all,

I am Lua-programming for the NoteCase Pro outliner (it uses Lua as its
scripting language).
WIth Lua scripts, I have added quite a lot of new features to NoteCase
Pro, planning to release those scripts and script collections as
plugins soon.

If you are interested, you can have a look at my homepage:
http://www.hermocom.com/products/notecase/plugins

I also had the idea to add email support (SMTP, maybe POP3, maybe
IMAP4) to NoteCase Pro via Lua, mainly at first to quickly being able
to send out information vial email, which has been generated and
stored in the outliner, but of course the idea quickly grew and -
being an outliner - NoteCase Pro would be a quite good GUI for a
simple complete email client.

But SMTP functionality would be the first goal.

Let's keep in touch about this. For me it could take some months until
I can begin my work on this, but as soon as I get somewhere, I will be
glad to share experiences and code with you guys.

Daniel

Reply | Threaded
Open this post in threaded view
|

Re: Homemade email system using LuaSocket and LuaPOP3

Nicolas-10
In reply to this post by Jeff Pohlmeyer
> A few years back somebody who went by the name "darkgod" had written
> a SMTP server in Lua. I managed to track down the website, but it
> seems to have a lot of broken links, including the link to the source
> code. This is about as close as I could get:
>
>   http://net-core.org/category/tethys
>
> I think the author might be hanging out here now:
>
>   http://te4.org/blogs/darkgod

I'm still there, lua forever!

I'm still using tethys for myself, mailcatch and my company, sending
and receiving tons of mails, but since there didnt seem to be much interrest
and my own lack of time I did not really update the website.
If there is interrest I could.

This is not however exactly what the original poster wanted, this is a SMTP server
not a client.
It does however allow to deliver mails into a maildir format (others are possible as plugins)
so at least this can answer the "how do I store things" question

Reply | Threaded
Open this post in threaded view
|

Re: Homemade email system using LuaSocket and LuaPOP3

Petite Abeille
In reply to this post by clemens fischer

On Sep 21, 2011, at 12:45 AM, clemens fischer wrote:

>> [1] http://cr.yp.to/ucspi-tcp/tcpserver.html
>
> similiar:
>
> http://smarden.org/ipsvd/index.html

More nifty tools:

http://thedjbway.b0llix.net/friends.html

Reply | Threaded
Open this post in threaded view
|

Re: Homemade email system using LuaSocket and LuaPOP3

Bertrand Mansion
In reply to this post by Nicolas-10
On Wed, Sep 21, 2011 at 6:22 PM, Nicolas <[hidden email]> wrote:

>> A few years back somebody who went by the name "darkgod" had written
>> a SMTP server in Lua. I managed to track down the website, but it
>> seems to have a lot of broken links, including the link to the source
>> code. This is about as close as I could get:
>>
>>   http://net-core.org/category/tethys
>>
>> I think the author might be hanging out here now:
>>
>>   http://te4.org/blogs/darkgod
>
> I'm still there, lua forever!
>
> I'm still using tethys for myself, mailcatch and my company, sending
> and receiving tons of mails, but since there didnt seem to be much interrest
> and my own lack of time I did not really update the website.
> If there is interrest I could.
>
> This is not however exactly what the original poster wanted, this is a SMTP server
> not a client.
> It does however allow to deliver mails into a maildir format (others are possible as plugins)
> so at least this can answer the "how do I store things" question

Please update it if you have some time, it's useful for me at least :)

--
Bertrand Mansion
Mamasam

Reply | Threaded
Open this post in threaded view
|

Re: Homemade email system using LuaSocket and LuaPOP3

Petite Abeille
In reply to this post by clemens fischer

On Sep 21, 2011, at 12:38 AM, clemens fischer wrote:

> According to RFC-5322 a "Message-ID" contains the string including the
> angle brackets.

Hmmm... somewhere near the end of "3.6.4.  Identification Fields":

"Semantically, the angle bracket characters are not part of the msg-id; the msg-id is what is contained between the two angle bracket characters."

Also... RFC 5256 (aka IMAP SORT and THREAD Extensions) mention the following:

Note: "Message ID" in the following description refers to a
            normalized form of the msg-id in [RFC2822].  The actual text
            in RFC 2822 may use quoting, resulting in multiple ways of
            expressing the same Message ID.  Implementations of the
            REFERENCES threading algorithm MUST normalize any msg-id in
            order to avoid false non-matches due to differences in
            quoting.

            For example, the msg-id
               <"01KF8JCEOCBS0045PS"@xxx.yyy.com>
            and the msg-id
               <[hidden email]>
            MUST be interpreted as being the same Message ID.






12