If you use a template, it's not too big a deal because you can just direct the output of the template into the mail function.
Failing the use of templates, you can always use the output buffering functions to capture the output of the page and pipe that into the mail function.
Here's a sample script which shows how to make html email:
/*
assume $to_email is the address of the recipient
$to_name is the name of the recipient
$from_email is address of the sender
$from_name is name of the sender
$plain_text is plain text version email
$html_text is html output
*/
// build html email headers //
// unique boundary
$boundary = uniqid("optional_defining_text_here");
// regex to filter the email addresses (ought to filter names, as well)
preg_match("/^([a-zA-Z0-9_-]*\.*[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+)/",$to_email,$matches);
$to_email = $matches[1];
preg_match("/^([a-zA-Z0-9_-]*\.*[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+)/",$from_email,$matches);
$from_email = $matches[1];
// continue building headers
$from = "From: $from_name<$from_email>\r\n"; // add From: header
$headers= "MIME-Version: 1.0\r\n" . // specify MIME version 1.0
"Content-Type: multipart/alternative" . // tell e-mail client this e-mail
"; boundary = $boundary\r\n\r\n" . // contains alternate versions
"This is a MIME encoded message.\r\n\r\n" . // message to people with clients
//who don't understand MIME
"--$boundary\r\n" . // plain text version of message
"Content-Type: text/plain; charset=ISO-8859-1\r\n" .
"Content-Transfer-Encoding: 7bit\r\n\r\n" .
//"Content-Transfer-Encoding: base64\r\n\r\n" . // alternate way of encoding
//chunk_split(base64_encode("$plain_text\n\n")) .
"$plain_text\n\n" .
"--$boundary\r\n" . // HTML
"Content-Type: text/html; charset=ISO-8859-1\r\n" .
"Content-Transfer-Encoding: 7bit\r\n\r\n" .
//"Content-Transfer-Encoding: base64\r\n\r\n" .
//chunk_split(base64_encode($html_text));
$html_text;
// send
$successful = mail("$to_name<$to_email>","Web_page_title",'',$from . $headers);
if(!$successful) {
print "<h3>Email Failed</h3>email failure, please contact the <a href='http://your_domain'>Webmaster</a>";
die;
}