The time for the formal greeting of consolation begins from the moment one dies until he is buried and for three days after his burial.
It is makrooh after that unless the consoling, or consoled, was away and did not return until three days had passed.
The formal greeting of consolation after three days is makrooh because its aim is to pacify the hearts of the grieving, and since people's hearts find peace after three days, one should not rekindle their grief.
Consolation after burial is better than before, because the family of the deceased are
busy preparing their deceased and because their grief for his loss is greater after burial.
It is makrooh for the family to get together (male or female) for formal sympathy
visits by people wishing to console them.
Rather, members of the family of the deceased should pursue their daily life, and only if one encounters one of them does one console him.
Al-Shafi'i (G. p. H) said: "I dislike exaggerated funeral ceremonies even if the relatives do
not cry out loud".
[Al-Majmu', Vol. 5, page 276].