Sahih Muslim Book 8, Hadith Number 3242.

Chapter: He who sees a woman and his heart is affected, should come to his wife, and should have intercourse with her.

Jabir heard Allah’s Apostle (May peace be upon him) say: When a woman fascinates any one of you and she captivates his heart, he should go to his wife and have an intercourse with her, for it would repel what he feels.