option to send mail when an error occurs