The html doesn't need to be encoded.... it's part of the message in "plain-text" format. So nothing more than generating html needs to happen. That is unless you're attaching an html document; then you might want to encode it.
You don't need the headers in the body, and since you're not even sending plain-text along with it (which is a bad idea since not all email clients will render html), you can just as easily follow Example #4 here and send just an html email.
Looking at the comment from akam (15-Jul-2008 01:51) may also help you out.
I would scrap what's there and write something entirely new. Something like:
<?php
// Get the HTML source
$html = LetterHead().FormTitle("PRICE ESTIMATE").CustomerInfoSection().OrderInfoSection().Terms();
// Convert HTML to plain-text by:
// 1. Replace "br" tags with new lines
// 2. Strip out HTML tags
// 3. Replace any triple or more new-lines in a row with a double new line
$text = str_replace('<br />', "\n", str_replace('<br/>', "\n", str_replace('<br>', "\n", $html)));
$text = striptags($html);
$text = preg_replace('~\n\n\n+~m', $text, "\n\n");
// Create the boundary id
$boundary = rand(0,9).'-'.rand(10000000000,9999999999).'-'.rand(10000000000,9999999999).'=:'.rand(10000,99999);
// Boundary used for any attachments...
$attach_bound = rand(0,9).'-'.rand(10000000000,9999999999).'-'.rand(10000000000,9999999999).'=:'.rand(10000,99999);
$headers = array(
'From: <info@test.com>',
'MIME-Version: 1.0',
'Content-Type: multipart/alternative; boundary="'.$boundary.'"'
);
$header = implode("\r\n", $headers)."\r\n";
$body = 'MIME-Version: 1.0
Content-Type: mutlipart/alternative; boundary="'.$boundary.'"
This i a multi-part message in MIME format.
--'.$boundary.'
Content-Type: text/plain; charset="windows-1256"
Content-Transfer-Encoding: quoted-printable
'.$text.'
--'.$boundary.'
Content-Type: text/html; charset="windows-1256"
Content-Transfer-Encoding: quoted-pritable
'.$html.'
--'.$boundary;
// Send the email...
mail('store@test.net', 'A New Quote', $body, $header);
Not a guarantee it will work, but it should step you in the right direction.
** Note: There may be some typos or syntax errors as this was just thrown together.
You could also look into swiftmailer or PHPMail projects to use their libraries instead if you wanted. Then you don't have to worry about any of this encoding vs. not encoding or attachment junk. It's all handled for you.
Swift Mailer
PHPMailer