Jane Buckingham's book "the Modern Girl's Guide to Life" has an amazing section on thank you notes; I highly suggest getting it, as it has other great tips and tricks as well.
To sum up what she said:
-DON'T write an email thank you, it shows that you're lazy.
-Send the thank you note no more than a week after the gift, party, or gesture
-Tell how you're going to use the gift or gift certificate
-If it was a dinner, interview, hospitable encounter, etc., try to praise specifics, mention at least one piece of enjoyable conversation, and don't put anything in writing that you wouldn't say in person.
All the adivce is good but also write the envelope and stamp it before you go out. That way its ready to pop in the post the next day. I do this most time because if I didnt for any reason I might end up sending the note later than I intended.
1) Start by complimenting the giver's thoughtfulness, generosity and/or creativity.
2) Find something specific to be thankful for. Instead of, "I love the blouse!" say "I especially like the fact that the blouse combines my favorite fabric--silk--with my favorite color--pink!"
3) If the gift was cash or a gift certificate, be specific about your plans for it, as in, "I can't wait to treat myself to a Broadway musical with your generous check!"
3) End with an appropriate sign-off, whether "Love," "Fondly," "As always," or whatever works given your relationship.
Always send it sooner rather than later. If its thanking someone for a present say how kind it was of the giver to think of you and how lovely the gift is. Put a line in to say how the gift is being used e.g. slippers - 'How cosy my feet are now'! Flowers - 'they are opening up beautifully and the fragrance fills the room' etc. If the gift was money then say how you plan to spend it or whether you are saving for something bigger. If its a meal you've had then just amend the wording accordingly.
Make it handwritten. It is mostly perfect if you write it in glittery inked pens. Stick some nice stickers on the letter and the envelope. This gives them high pride in you. Write the letter nice and simple. Make sure you write the reason why you're thanking them. At the end you should write "your hopefully bffl(best friend for life), (your name). So out your pen to paper if you agree with my tip
Obviously you must start by thanking them for the gift. Comment on how thoughtful and kind it was and say something you like about the gift or will find useful.