When writing a condolences email, state that you are sorry to hear about the death of the recipient's friend or family member. Let the recipient know that he is in your thoughts and prayers.
You can also mention how much you admire the recipient's strength and positive attitude during this very difficult time. It is appropriate to write a short fond memory about the deceased loved one if you knew the person. If you can empathize with the email recipient, offer a listening ear any time he wants to talk. State that you are willing to help out however you can to make this time a little less difficult.