Mail module porting

@jeremyletang, what's your opinion on that?