Section 51. No town or officer thereof shall publish or disclose in any manner to others than officers of any city, town or other governmental agency or the duly authorized agents of such officers the names of any persons residing in such town who received benefits under chapter one hundred and fifteen, except that a duly incorporated charitable corporation shall be informed, upon its request, as to whether or not any designated person has received such benefits. No department, board or commission, or agent thereof, of a town providing aid, guidance or advice solely to persons who are in active military or naval service during the time of war, or who were formerly in such service, or to the dependents of any such persons, shall furnish any records or information to any social service index, so called, or exchange information with any other agency, except as hereinbefore provided. Whoever violates any provision of this section shall be punished by a fine of not less than twenty-five nor more than five hundred dollars.