Add error logging for email