Musnad Ahmad 1035
It was narrated from Hisham:
My father told me that `Ali (رضي الله عنه) said to al-Miqdad: Ask the Messenger of Allah (ﷺ) about a man who gets close to a woman and emits madhi, for I am too shy to ask him because his daughter is married to me. The Messenger of Allah (ﷺ) said: “Let him wash his private part and testicles, and do wudoo`.
حَدَّثَنَا يَحْيَى بْنُ سَعِيدٍ، عَنْ هِشَامٍ، أَخْبَرَنِي أَبِي أَنَّ عَلِيًّا، رَضِيَ اللَّهُ عَنْهُ قَالَ لِلْمِقْدَادِ سَلْ رَسُولَ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ عَنْ الرَّجُلِ يَدْنُو مِنْ الْمَرْأَةِ فَيُمْذِي فَإِنِّي أَسْتَحْيِي مِنْهُ لِأَنَّ ابْنَتَهُ عِنْدِي فَقَالَ رَسُولُ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ يَغْسِلُ ذَكَرَهُ وَأُنْثَيَيْهِ وَيَتَوَضَّأُ‏.‏