How To Thank Allahu Ta'ala?

Hadrat [1] Imam-i Rabbani says in the 17th letter of the third volume of his Maktubat:

Everybody knows that he who does favours should be thanked. It is a requirement of being human. Those who do favours are respected. Generous people are deemed great. Then, it is a requirement of being a human to thank Allahu ta'ala, who is the real owner of every blessing. It is a duty, a debt, which the mind necessitates.

However, since Allahu ta'ala is free from any defect or fault, while men are smeared with the taint of defects and with the stains of deficiency, they do not have any relationship with Him. They cannot understand how great He is or how to thank Him accordingly. Methods which they think of as beautiful and use to describe Him may be loathsome to Him. What they think appropriate as a way of lauding and praising Him may, in fact, insult and belittle Him. Unless He dictates the means by which He should be praised and thanked, other ways cannot be trusted as being worthy of Him, nor can they be acceptable ways of worshipping Him.

A way that a man chooses to thank Him may actually be a form of slander. Therefore, the religions and shari'ats [2] which have been communicated by His prophets 'alaihim-us-salawatu wa-t-taslimat' reveal how He should be praised, respected and thanked. Ways of respecting Him through the heart are communicated in the religion, and the thanks that are rendered to Him by the tongue are, again shown there. Religions explain clearly and in detail the actions which every organ will do.

Then, thanking Allahu ta'ala by believing with the heart while the body does certain actions is possible only by adapting oneself to the religion. The reverence and the worship that is rendered to Allahu ta'ala outside the religion cannot be depended upon. They usually are done in a form contrary to His wishes and what is thought of as a blessing turns out to be a sin. As it is understood from these words, following the religion is a requirement of being a human and is something which the mind approves and likes. Allahu ta'ala cannot be thanked outside His religion.

Source:Turktakvim

[1] Hadrat: title of respect used before the names of great people like and Islamic scholars.
[2] Shari'at: (pl. of Shari'a) i) rules and commandments as a whole of the religion. ii) religion.