Yes, I know the font tag is deprecated, but for testing purposes it was quicker - especially for the message destined to be emailed.
After constructing the string, it is immediately processed by the following function and set as part of the $message class email object () (i'm not the author of the class so i do not know it inside and out.)
foreach ($_POST as $key => $value){
if ($key != "Submit"){
$fieldSubject = ucwords(str_replace("_"," ",$key));
$htmlMessageString = $htmlMessageString . "<font color=red>" . $fieldSubject . ":</font>" . trim($value) . "<br /> ";
$textMessageString = $textMessageString . $fieldSubject . ": " . trim($value) . "\r\n";
}
}
$message->SetTextContent($textMessageString);
$message->SetHtmlContent($htmlMessageString);
$message->Send();
the functions in the email class are:
function SetHtmlContent($content) {
return $this->SetContent($content, 'text/html', '8bit');
}
function SetContent($content, $mimeType='text/plain', $encoding='8bit'){
$contentBlock = new LiteralMimeBlock($mimeType, $content, $encoding);
return $this->AddContentBlock($contentBlock);
}
I recently received a reply, from the original author of the class, which has resolved the problem. . He suggested changing:
$message->SetTextContent($textMessageString);
$message->SetHtmlContent($htmlMessageString);
To:
$message->SetContent(chunk_split(base64_encode($textMessageString), 76, EmailNewLine), 'text/plain', 'base64');
$message->SetContent(chunk_split(base64_encode($htmlMessageString), 76, EmailNewLine), 'text/html', 'base64');