It is narrated from Sayyiduna Abdullah bin Abbas (may Allah be pleased with them both) that a man came to the Prophet (peace and blessings be upon him) and spoke with great eloquence, so the Messenger of Allah (peace and blessings be upon him) said: "Some eloquence certainly has the effect of magic, and some poetry is certainly based on wisdom."
Related hadith on this topic