refactored mail dependencies and settings