mailsender refactored