email_on_error utility method