diff --git a/include/class.thread.php b/include/class.thread.php index 6ec237888567b074704e045bb80649727269e8db..a717e89af82c02a521cd8d972ff3821812475c8b 100644 --- a/include/class.thread.php +++ b/include/class.thread.php @@ -726,8 +726,15 @@ 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 <%s>\n\n", $mailinfo['name'], + $mailinfo['email']); + if ($body instanceof HtmlThreadBody) + $header = nl2br(Format::htmlchars($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 +1392,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');