Added error trapping in sending of email and putting it in log.