From 2a25de52c8cfed5ae8288adff668cafe08df2826 Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Tue, 4 Feb 2014 11:02:39 -0600
Subject: [PATCH] Always keep recipients list

If an email arrives at the system and the system cannot determine why the
mail arrived (ie. a system email was not found in the To or Cc headers), the
recipients list should be maintained.

This is useful for generating collaborator lists as well as filtering by the
To and Cc (Addressee) headers.
---
 include/class.mailfetch.php | 1 -
 include/class.mailparse.php | 1 -
 2 files changed, 2 deletions(-)

diff --git a/include/class.mailfetch.php b/include/class.mailfetch.php
index 9c4afe9b4..36996e950 100644
--- a/include/class.mailfetch.php
+++ b/include/class.mailfetch.php
@@ -306,7 +306,6 @@ class MailFetcher {
 
         //BCCed?
         if(!$header['emailId']) {
-            unset($header['recipients']); //Nuke the recipients - we were bcced
             if ($headerinfo->bcc) {
                 foreach($headerinfo->bcc as $addr)
                     if (($header['emailId'] = Email::getIdByEmail(strtolower($addr->mailbox).'@'.$addr->host)))
diff --git a/include/class.mailparse.php b/include/class.mailparse.php
index e9f83de4d..3a49a66b5 100644
--- a/include/class.mailparse.php
+++ b/include/class.mailparse.php
@@ -466,7 +466,6 @@ class EmailDataParser {
 
         //maybe we got BCC'ed??
         if(!$data['emailId']) {
-            unset($data['recipients']);
             $emailId =  0;
             if($bcc = $parser->getBccAddressList()) {
                 foreach ($bcc as $addr)
-- 
GitLab