diff --git a/include/class.thread.php b/include/class.thread.php index dc8a559e1158ca0f8d23d741e6a6e61de5b1e838..ce03a4a268cf2659eb934d39d759cc6038ec94b9 100644 --- a/include/class.thread.php +++ b/include/class.thread.php @@ -742,8 +742,14 @@ Class ThreadEntry { else { //XXX: Are we potentially leaking the email address to // collaborators? - $vars['message'] = sprintf("Received From: %s\n\n%s", - $mailinfo['email'], $body); + $header = sprintf("Received From: %s\n\n", $mailinfo['email']); + if ($body instanceof HtmlThreadBody) + $header = nl2br($header); + // Add the banner to the top of the message + if ($body instanceof ThreadBody) + $body->prepend($header); + + $vars['message'] = $body; $vars['userId'] = 0; //Unknown user! //XXX: Assume ticket owner? return $ticket->postMessage($vars, 'Email'); } @@ -1385,6 +1391,14 @@ class ThreadBody /* extends SplString */ { return $this->display('html'); } + function prepend($what) { + $this->body = $what . $this->body; + } + + function append($what) { + $this->body .= $what; + } + function asVar() { // Email template, assume HTML return $this->display('email');