Mail config refactoring