Emailing error handling

Added email error handling