Refactor mail config