The Messenger of Allah ﷺ said, "People, Allah is pure and accepts only what is pure. Allah has commanded the believers with what He commanded the messengers. He said, 'Messengers, eat from the good things and do righteous deeds. Indeed, I am Knowing of what you do' [Muminun 23:51]. And He said, 'You who have believed, eat from the good things which We have provided for you' [Baqarah 2:172]."Then he mentioned a man who travels far, dishevelled and dust-covered, stretching out his hands to the sky, crying, "Lord, Lord!" while his food is unlawful, his drink is unlawful, his clothing is unlawful, and he is nourished by what is unlawful. So how could such a person be answered?
قال رسول الله ﷺ: أيها الناس إن الله طيب لا يقبل إلا طيبا وإن الله أمر المؤمنين بما أمر به المرسلين فقال: {يايها الرسل كلوا من الطيبت واعملوا صلحا إني بما تعملون عليم} [المؤمنون: ٥١] وقال: {يايها الذين ءامنوا كلوا من طيبت ما رزقنكم}[البقرة: ١٧٢]. ثم ذكر الرجل يطيل السفر أشعث أغبر يمد يديه إلى السماء: يا رب، يا رب، ومطعمه حرام ومشربه حرام وملبسه حرام وغذي بالحرام فأنى يستجاب لذلك.
Muslim narrated it in the chapter on zakat (1015), from Abu Bakr Muhammad bin Ala, who said, Abu Usama told us, Fudayl bin Marzuk told us, Adi bin Thabit told me, from Abu Hazim, from Abu Hurairah, who mentioned it.