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ʿ.
لِلْمِقْدَادِ سَلْ رَسُولَ اللهِ ﷺ عَنِ الرَّجُلِ يَدْنُو مِنَ الْمَرْأَةِ فَيُمْذِي فَإِنِّي أَسْتَحْيِي مِنْهُ لِأَنَّ ابْنَتَهُ عِنْدِي فَقَالَ رَسُولُ اللهِ ﷺ يَغْسِلُ ذَكَرَهُ وَأُنْثَيَيْهِ وَيَتَوَضَّأُ