Refactoring MailManager.