“O slavewoman of the Compeller, where are you headed?” She said: “To the mosque.” He said: “And have you put on perfume for that?” She said: “Yes.” He said: “I heard the Messenger of Allah (ﷺ) say: ‘Any woman who puts on perfume then goes out to the mosque, no prayer will be accepted from her until she takes a bath.’”
Sunan Ibn Majah Book 36, Hadith 77