Praise be to Allah.
It was narrated that the Messenger of Allaah (peace and blessings of Allaah be upon him) said: “Whoever eats garlic or onions, let him not approach our mosque and let him pray at home.”
And it was reported that he (peace and blessings of Allaah be upon him) said: “The angels are offended by the same things that offend the sons of Adam.”
Everything that has an offensive smell is subject to the same ruling as garlic and onions, such as a smoker or a person who has an offensive smell in his armpits or other smells that are offensive to those with whom he sits. It is makrooh for him to pray in congregation and he is not allowed to do that until he uses something to get rid of this smell. He has to do that as much as he can, so that he do what Allaah has enjoined upon him and pray in congregation. As for smoking, it is absolutely haraam and should be given up at all times, because of its many harmful effects on one’s religious commitment, physical health and finances.