Email settings refactoring