Section 12. Corporations organized for the purpose of transporting the United States mail, merchandise and other articles by means of pneumatic pressure or power, corporations engaged in or organized for the purpose of manufacturing, buying, selling, distributing or dealing in artificial cold and refrigerating and cooling materials and corporations organized for any of the purposes mentioned in section three, may, with the written consent of the aldermen of a city or the selectmen of a town, dig up and open the ground in any of the streets, lanes and highways thereof, so far as is necessary to accomplish the objects of the corporation; but such consent shall not affect the right or remedy to recover damages for an injury caused to persons or property by the acts of such corporations. They shall put all such streets, lanes and highways into as good repair as they were in when opened; and upon failure so to do within a reasonable time shall be guilty of a nuisance.