When is Flattery Prohibited?

In his gloss to the Shulhan Aruch the Magen Avraham (Orah Haim 156:3) list a series of prohibitions not specifically mentioned in the Shulhan Aruch. One of these is the prohibition of “Hanufa” (flattery), which in this context means complimenting a wanton sinner and such a person’s ways. The Gemara (Sotah 42a) says that flattery is such a negative act that those who engage in it do not merit the Divine Presence. Nevertheless,the Orhot Tzadikim explains that supporting the positive deeds of a sinner for the end-goal of bringing him closer to Hashem is not considered flattery, and is therefore permissible.  Additionally, it is a Mitzvah for a husband to flatter and compliment his wife so as to maintain marital harmony.

Summary:     Flattering a wicked person and his ways is forbidden. Conversely, it is proper to compliment one’s positive deeds or traits so as to bring one closer to Hashem and the Torah.