Email service refactoring