Ma’qil ibn Yasar reported: The Messenger of Allah, peace and blessings be upon him, said, “For an iron nail to pierce the head of one of you would be better for him than to touch a woman who is not lawful for him.”
Source: al-Mu’jam al-Kabīr lil-Ṭabarānī 20/211
Grade: Sahih (authentic) according to Al-Albani
عن مَعْقِل بْن يَسَارٍ قَالَ قَالَ رَسُولُ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ لأَنْ يُطْعَنَ فِي رَأْسِ أَحَدِكُمْ بِمِخْيَطٍ مِنْ حَدِيدٍ خَيْرٌ لَهُ مِنْ أَنْ يَمَسَّ امْرَأَةً لا تَحِلُّ لَهُ
20/211 المعجم الكبير للطبراني
5045 المحدث الألباني خلاصة حكم المحدث صحيح في صحيح الجامع