Better error handling for email sending