A woman came to the Messenger of Allah ﷺ and said, "Messenger of Allah, I have offered myself to you in marriage."She stood for a long while, then a man rose and said, "Messenger of Allah, marry her to me if you have no need of her."The Messenger of Allah ﷺ asked, "Do you have anything you can give her as a dowry?"He replied, "I have nothing but this lower garment of mine."The Messenger of Allah ﷺ said, "If you give her your garment, you will be left with no garment to wear. Find something else."He said, "I cannot find anything."The Prophet ﷺ said, "Search, even if it be only an iron ring."He searched but could not find anything.The Messenger of Allah ﷺ then asked him, "Do you know any of the Quran?"He replied, "Yes, such-and-such surah and such-and-such surah," naming the surahs.The Messenger of Allah ﷺ said to him, "I have married her to you for what you know of the Quran."
حدثنا القعنبي عن مالك عن أبي حازم بن دينار
أن رسول الله ﷺ جاءته امرأة فقالت يا رسول الله إني قد وهبت نفسي لك فقامت قياما طويلا فقام رجل فقال يا رسول الله زوجنيها إن لم يكن لك بها حاجة فقال رسول الله ﷺ هل عندك من شيء تصدقها إياه فقال ما عندي إلا إزاري هذا فقال رسول الله ﷺ إنك إن أعطيتها إزارك جلست ولا إزار لك فالتمس شيئا قال لا أجد شيئا قال فالتمس ولو خاتما من حديد فالتمس فلم يجد شيئا فقال له رسول الله ﷺ فهل معك من القرآن شيء قال نعم سورة كذا وسورة كذا لسور سماها فقال له رسول الله ﷺ قد زوجتكها بما معك من القرآن
Bukhari narrated it in "The Book of Agency," in the chapter on a woman appointing the imam as her agent in marriage, no. 2310, through the hadith of Malik with this chain, and it is in the Muwatta (Yahya's version), 2/526. Muslim also narrated it, no. 1425, through the hadith of Abu Hazim with this chain.