Mahmud bin Labid (may Allah have mercy on him) narrates from Sayyiduna Mu'adh bin Jabal (may Allah be pleased with him) that a son of his passed away, so the Messenger of Allah (peace and blessings be upon him) wrote to him consoling him over his son: "In the name of Allah, the Most Gracious, the Most Merciful. From Muhammad, the Messenger of Allah (peace and blessings be upon him), to Mu'adh bin Jabal: Peace be upon you. I praise before you Allah, besides whom there is no god worthy of worship. To proceed: may Allah make your reward great, grant you patience, and grant us and you gratitude. Indeed, our souls, our wealth and our families are among the pleasant gifts of Allah and His loans entrusted (to us); He lets us enjoy them for a fixed term and takes them back at an appointed time. We ask Him for gratitude for what He gives, and for patience when He tests. Your son was among these pleasant gifts of Allah and His entrusted loans; Allah let you enjoy him with joy and delight, then took him back from you with a great reward: (Allah's) blessings, mercy and guidance, if you count him (as a loss for the sake of Allah's reward). So be patient, and do not let your impatience nullify your reward so that you regret it. And know that impatience neither brings back the dead nor drives away grief, and what is bound to descend is as though it has already happened. And peace."
Hadith Referenceالمعجم الكبير للطبراني / باب الميم / 17460