[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: MIME Mail parsing
- From: DarkGod <darkgod@...>
- Date: Tue, 19 Feb 2008 17:04:39 +0100
Hullo again,
I seem to remember somebody here asking for a mime parsing lib.
There is one in the Tethys SMTP server in tethys2.util.MIMEMail.
There are barely any comments and docs but it might still be useful.
Basic using is something like:
local MIMEMail = require'tethys2.util.MIMEMail'
local mime = MIMEMail.new(data) -- data being a table of string, one
-- for each line of text
mime:parse()
mime:split() -- optional, this changes the way data is represented
Then you can access the mail structure in mime.mail.
Interresting fields are mime.mail.headers, mime.mail.parts and mime.mail.body.
Headers is a table of haeder = value
Body is the index in the mime.bodies table of the body of the mime part.
Parts is a table of mail parts whose structure is the same as described.
It is probably incomplete and bugged, but at least it's there to improve it :)
If there are enough interrest I might release it as its own library outside
of Tethys.
Have fun!
--
DarkGod <darkgod@t-o-m-e.net>