“إذا تنخم أحدكم و هو في المسجد فليغيب نخامته لا تصيب جلد مؤمن أو ثوبه فتؤذيه”
(حم ع ابن خزيمةيه
439 – It is reported that the Messenger of Allah (peace and blessings of Allaah be upon him) said:
“If any of you (wants to) spit while he is in the mosque, let him bury his phlegm so that it does not get on the skin or the believer’s clothing that will cause him trouble.”
This hadith was narrated by Ahmad, Abu Ya’la, Ibn Khuzaim, al-Bayhaq’i in Shu’ab al-Iman and ad-Diya al-Maqdisi from the words of Sa’d.
Sheikh al-Albani called the hadith good. See Saheeh al-jami ‘as-saghir 439.