A 59-year-old man has been sentenced to more than three years in prison for sending threatening letters to four New York judges while he was an inmate.