Elchonon Galbut
Parshas Vayeshev refers to Yoseph as a "shepherd,
a youth (na'ar), with the sons of Bilhah and the sons of Zilpah" (37:2). Rashi attributes the Torah's labeling of Yosef as a "youth" to Yosef's immature behavior, which included "combing his hair and adorning his eyes to look pretty." According to the Maharal, because Yoseph was constantly involved with these childlike, vain obsessions, he gravitated toward other childish activities, such as Loshon Hora. The Midrash relates that Yoseph was punished midah k'neged midah for speaking Loshon Hora against his brothers. For telling his father that his brothers were involved in illicit relationships, Yosef was subjected to one of his greatest tests, the seduction of "Eishes Potiphar."
On the pasuk, "Now Yoseph was handsome of form and handsome of appearance (39:6)," Rashi quotes the following Midrash: "Once Yoseph perceived himself as a ruler, he began to eat drink and curl his hair. Hashem said, 'Your father is mourning and you curl your hair. I will provoke the bear (the wife of Potiphar) against you immediately.'" Yoseph is being portrayed as a vain and selfish individual, and the Midrash draws on this as the reason that "Eishes Potiphar" sought to seduce Yoseph.
The nissayon of "Eishes Potiphar" indeed appears a proper punishment for Yoseph's arrogance, as the Loshon Hora he told about his brothers, as well as the arrogant behavior which led his brothers to despise and sell him, stemmed directly from his vanity and conceit. When the pasuk tells us that Yoseph was a very handsome person, one can assume that Yoseph was well aware of this. Accordingly, it seems that Yoseph used this gift as an excuse to concentrate on himself rather than devoting his blessing to the service of Hashem. Yoseph needed a lesson on the value of a b'rachah and the adverse consequences of its misuse. Thus, not only did Yosef's arrogance lead to his speaking Loshon Hora; it also led to the development of a stumbling block, desire and jealousy, in the heart of "Eishes Potiphar." Hashem wanted to show Yoseph the products of a misused blessing in order to sensitize him to the innate power of a b'rachah. It may very well be that one of Joseph's biggest trials was actually the way in which he gained an understanding of what a b'rachah really is.
Rabbi Eliyahu Dessler, in Michtav MeEliyahu, offers the following explanation of the concept of "Ayin Hora": The blessings which have been received from Hashem should not be a source of anguish to others; when the b'rachos (wealth, children, etc.) of one person cause pain to another--and certainly if one flaunts those blessings--he arouses a divine judgment against himself, prompting a reevaluation of whether or not he truly deserves those blessing.
Along the lines of Rabbi Dessler's definition of "Ayin Hora," it is proper to note a Gemara in Berachos (20a). Rebbi Yossi Bar Chanina notes that the evil eye has no power against Yoseph. This is attributed to his refusal to enjoy that which was not his, that is, his refusal to be seduced by the wife of Potiphar. It is possible to say that the test of "Eishes Potiphar" and the consequences it produced were the way in which Yoseph learned how to truly appreciate the power of a blessing. He understood that it is not the right of man to use a blessing for personal aggrandizement; rather, with it one must serve Hashem. Once Yoseph understood this, he became immune to the "Ayin Hora."