refactor mail library
create lib directory