Islam approved and encouraged poetry that is not contradictory to Islam and morals. Prophet Mohammad (p.b.u.h) spoke in a hadith as the following:
“Some poetry contains wisdom.” (Bukhari, Good Manners & Forms, 6145)
Moreover there are many accounts in hadith books, that Prophet Mohammad (p.b.u.h) himself recited poems, also allowed his companions such as Hassan b. Thabit, Amir b. Al-Aqwa and others to recite poems, including the book of Bukhari.
On the other hand when poetry takes destructive forms it is regarded as harmful and is disparaged. In the account of poets that misguide people to sinful path, the verse in the surah Ash-Shu’ara (The Poets) commands the following:
“As for those poets, only the perverse follow them. Do you not see that they go too far in every direction and say things, which they cannot do?” (Ash-Shu’ara/The Poets 26:224-226)
The poets that do not recite poetry that contradict to Islam and morals are excluded from this verdict:
“Except those who believe and act righteously and remember Allah much, and when they themselves were subjected to wrong, they exacted retribution no more than to the extent of the wrong? Soon will the wrong-doers know by what overturning they will be overturned.” (Ash-Shu’ara/The Poets 26:227)