in reply to email output using HTML format.

A good start would be to add something like 'Content-Type: text/html' right after the subject line (without the quotes )