Here’s a story that was told by Rabbi Chaim Vital, the famed student of the Ari HaKodosh, and which can be found in his Sefer HaGilgulim.
Many a time the Ari HaKodosh would send his prized student, Rabbi Chaim Vital on important missions in order to help people who had various problems or were possessed with ruchos and mazikim (harmful or destructive spirits). Rabbi Chaim Vital would, of course, use the secret methods of kabbala handed down to him by his revered master in order to expel these destructive forces from the person’s home. When Rabbi Chaim would ask the mazikim how they were able to gain entry into the house, they would point to the door with the posul Mezuzah. “It is through this door that we were able to get in here.”
This story should serve as a scary and frightening lesson as to what can chas v’sholom happen if the mezuzos are not in good condition. After all, it comes to us straight from the source – the mazikim themselves!