refactor MailCtrl