The mid-infrared spectrum of the zodiacal and exozodiacal light