you can also post and read cookies using javascript, which you said you're already using in your code.
in the html email, the code from the thankyou email template runs on the user's machine, where the cookie resides.
i use php for some dynamic features on my pages and had to switch it over to javascript for the cart pages, which included reading cookies and such. i didn't happen to use any dynamic features in the thankyou email, but i have inspected the properties of the email and can see the html code that is embedded in the emails message. a quick test might tell you javascriot there would function properly.
see the last panel here for the template code, where you can customize the html (with javascript):
http://shopsite.com/templates/cookbook/ ... cart.shtml