fixes 204: wrap $mail call in onError in try/catch block