lua-users home
lua-l archive

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

On Nov 12, 2008, at 6:53 PM, Jose wrote:

I am new to lua and am looking for the basic function to parse a raw
email message and decode the email content depending on the different

Ah, yes... a fully compliant MIME parser in pure Lua would be nice... :)

In the meantime, here is a mostly non-compliant one:

Usage example:

local MIME = require( 'MIME' )

local aMIME = MIME( '3_12_2007.eml', 'rb' ):read( '*all' ) )

print( aMIME.type )

for anIndex, aValue in ipairs( aMIME.content ) do
    print( aValue.type )

> multipart/alternative
> text/plain
> text/html

The MIME table has 3 attributes of interest: header, type and content.