Al-Nawawī says in his commentary on Ṣaḥīḥ Muslim:
“In it lies the recommendation of this supplication.”
I reply: To deem it merely recommended requires evidence that shifts the wording of the command—which in its apparent sense denotes obligation—to mere recommendation, and no such evidence, to our knowledge, exists. Had anything of the sort been available, al-Nawawī or someone else would surely have cited it. For that reason Imām Ibn Ḥazm considered the supplication obligatory, saying in al-Muḥallā (4/60):
“It is obligatory upon anyone who enters the mosque to say: ‘O Allah, open for me the gates of Your mercy,’ and when he leaves to say: ‘O Allah, I ask You for Your bounty.’ This is required for entering the mosque whenever one enters, not a condition of the prayer itself; thus the prayer of one who omits it is still valid, yet he has sinned by abandoning what he was commanded to do.”
He then cited the hadith in Muslim’s transmission from Abu Ḥumayd—or Abu Usayd. Muslim’s wording, however, does not contain the phrase “and let him send peace,” as noted earlier. It appears that Ibn Ḥazm was unaware of that wording in the other narrations, and likewise of Abu Hurayrah’s hadith that includes both additional phrases; otherwise he would have mentioned them and would have ruled the salutation obligatory as well.
The obvious sense of the hadith, therefore, establishes only the obligation of sending peace upon the Prophet ﷺ, while sending blessings upon him remains recommended, for the latter is affirmed by his own practice, as explained above. One might argue, however, that the term “peace” (salām) is general, and he ﷺ clarified it by combining both blessings and peace in his own conduct. This in fact corresponds to the Almighty’s statement: