Shaykh 'Uthaimeen (rahimahullaah) gives the solution to sadness, depression and grief:
"Indeed the Legislation orders us to keep away from everything which causes regret. Allaah سبحانه said:
"Secret counsels (conspiracies) are only from Satan, in order that he may cause grief to the believers. But he cannot harm them in the least, except as Allaah permits." [Mujaadilah, 58:10]
And Allaah تعالى only told us this so that we keep away from it, it was not merely a piece of information telling us that the Devil wants to cause us grief, no, what is meant is that we keep away from everything which causes grief. And for this reason the Prophet ﷺ said, "When there are three people, two should not converse together to the exclusion of the third." [Agreed upon]
So everything which brings about sadness in a person is forbidden ...
The Prophet ﷺ ordered a person who saw a dream that he disliked to dry-spit to his left three times and seek Allaah's Refuge from its evil and the evil of the Devil and to then turn to the other side [to sleep on] and not to tell anyone about it and to perform ablution and pray—all of this so that a person can drive away all of these things [grief etc.] ...
And that is why the Companions said that we used to see dreams and become ill because of them, but when the Prophet of Allaah ﷺ told us this hadith ... i.e., they relaxed and no worry remained.
So the Legislator wants us to avoid everything which brings about worry, grief, and sadness, and for this reason Allaah تعالى said:
"So whosoever intends to perform Hajj therein then he should not have sexual relations (with his wife), nor commit sin, nor dispute unjustly during the Hajj." [Baqarah 2:197]
Because disputes make a person defend himself and his thoughts change for the sake of the argumentation, and he will became worried and it will distract him from worship.
The point is: Always keep in mind the fact that Allaah عزوجل wants you to be happy all the time, far from grief.
And in reality a person has three situations:
- A past situation;
- A present;
- Aa future one.
A person forgets the past and the worry that it had because it and what it contained is over, if it was a calamity, then say:
اللهُمَّ أَجُرْنِي فِي مُصِيبَتِي، وَأَخْلِفْ لِي خَيْرًا مِنْهَا
"O Allaah, reward me for my affliction and give me something better than it in exchange for it," [Muslim]
...and forget about it.
And for this reason He forbade wailing over the dead, why? Because it renews the grief and reminds one of it.
As for the future, its knowledge is with Allaah عزوجل, rely on Allaah and when issues come to you then seek their solution, but those things which the Legislator has ordered you to prepare for then prepare for them.
It is the present time which it is possible for you to deal with, try to keep away from everything that causes worry, grief and sadness so that you can always be relaxed and have an open breast, dedicating yourself to Allaah and worshipping Him and [dedicating yourself] to your worldly affairs and those connected to the Hereafter.
When you try this, you will relax.
As for tiring yourself over what has passed or worrying about the future in a manner the legislation has not allowed, then know that [if you do so] you will become exhausted and lose out on much good."
Source: Fathu Dhil-Jalaali wal-Ikraam bi Sharh Bulughil-Maraam, vol. 3, pp. 532-533.