Answer:
It's easy to write a polite letter!
First, thank them for the invitation, even if you're not going to attend. Next, tell them that you will certainly attend. Tell them you are looking forward to coming. Then, sign it sincerely (if they are close friends, you can sign it more casually with love).
Here's an example:
Dear Mr. and Mrs. Johnson,
Thank you so much for inviting me to your daughter's wedding. I will certainly attend. I am looking forward to seeing her marry Henry.
Sincerely,
Annie