Send the letter as soon as you are certain about the cancellation. The earlier you inform the hotel, the better chances you have of receiving a refund. Many hotels have cancellation deadlines, so try to send the letter well before that deadline.