(2)If any sheriff or other officer sells any lands or tenements by virtue of any such execution, otherwise than in the manner aforesaid, or without such previous notice, the sheriff or other officer so offending shall forfeit and pay the sum of fifty dollars for every offense to be recovered, with costs of suit, in any court of record in this state by the person whose lands were advertised and sold. No such offense nor any irregularity on the part of the sheriff or other officer having the execution shall affect the validity of any sale made under it, unless it appears that the purchaser had notice of such irregularity.