refactoring email configuration.