Added handler to send emails on internal errors.