refactored email sender