Man appears in court accused of sending 'harassment messages