restructure mail module