All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad is His slave and Messenger. We ask Allaah to exalt his mention as well as that of his family and all his companions.
There is an evidence both in the Book of Allaah and the Sunnah of the Prophet that magic exists and the reality proves it as well. Indeed it is envy as the questioner has stated. There is no difference of opinion among the scholars regarding the extent of the effect of magic, as it can lead to a separation between the husband and his wife and can cause a person to become sick and so on. Also there is no difference of opinion among the scholars that its effect can not reach the level of the miracles of the Prophets, like raising the dead, making animals speak, or parting the sea, and so on. What we have to believe, though, is that magic has the effects we stated above and that it really exists. We have also to believe that magic does not affect anybody save with the Permission and Will of Allaah. Allaah says (interpretation of meaning): {But do not harm anyone through it except by the Permission of Allaah.}[2:102]. Allaah does not will magic to happen except that there is a wisdom behind it. Allaah says (which means): {And you do not will except that Allaah wills. Indeed, Allaah is ever Knowing and Wise.}[76:30]. What Allaah wills is due to His Wisdom and Knowledge.
As regards how to get rid of magic, you could seek Ruqyah by the Book of Allaah and the Sunnah of the Prophet as they are a complete cure. However, it is not permissible to seek to remove magic with magic, or to go to magicians and fortune-tellers. Moreover, there is no religious means which leads to discovering who is a magician, and one should not believe that a specific person has afflicted him with magic without an evidence because the latter could be innocent, as there is no benefit in this suspicion in principle. Nonetheless, a person who is affected by magic, has to seek to get rid of it by permissible religious means.
Allaah knows best.