From 385be007f2fd177596ae3d624b08c481a9b342c6 Mon Sep 17 00:00:00 2001 From: Jared Hancock <jared@osticket.com> Date: Thu, 23 Jan 2014 11:39:01 -0600 Subject: [PATCH] Ticket thread supports specifying `thread-type` This allows the email system to detect something like a bounce mail and specify that the associated message should be an internal note. --- include/class.thread.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/include/class.thread.php b/include/class.thread.php index 89a5d0af5..2fda4bcae 100644 --- a/include/class.thread.php +++ b/include/class.thread.php @@ -575,6 +575,7 @@ Class ThreadEntry { 'ip' => '', 'reply_to' => $this, ); + $errors = array(); if (isset($mailinfo['attachments'])) $vars['attachments'] = $mailinfo['attachments']; @@ -591,7 +592,6 @@ Class ThreadEntry { elseif ($staff_id = Staff::getIdByEmail($mailinfo['email'])) { $vars['staffId'] = $staff_id; $poster = Staff::lookup($staff_id); - $errors = array(); $vars['note'] = $body; return $ticket->postNote($vars, $errors, $poster); } @@ -599,6 +599,15 @@ Class ThreadEntry { // Don't process the email -- it came FROM this system return true; } + // Support the mail parsing system declaring a thread-type + elseif (isset($mailinfo['thread-type'])) { + switch ($mailinfo['thread-type']) { + case 'N': + $vars['note'] = $body; + $poster = $mailinfo['email']; + return $ticket->postNote($vars, $errors, $poster); + } + } // TODO: Consider security constraints else { $vars['message'] = sprintf("Received From: %s\n\n%s", -- GitLab