added email error handling.