added logging in case of failure with email sending