I use output buffering when doing things like this:
Sample
--8<----------------
...
ob_start();
// Insert your old HTML code here
$buffer = ob_get_contents();
// $buffer now contains HTML file
ob_end_clean();
mail( $to, $subject $buffer );
----------------->8--
Or may be I didn't understand :]