From 1bd37820b357136e7a1ae583cf00690486e9e5cf Mon Sep 17 00:00:00 2001
From: JediKev <kevin@enhancesoft.com>
Date: Mon, 30 Jul 2018 12:14:29 -0500
Subject: [PATCH] collab: @localhost Mailer Error
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This addresses issue 4370 where Users responding to tickets via Client
Portal triggers a “Failed to add recipient: @localhost” Mailer Error in the
osTicket Logs. This is due to the `notifyCollaborators()` function that
lacks a check for an empty mailing list.
---
 include/class.ticket.php | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/include/class.ticket.php b/include/class.ticket.php
index c9811934a..49513b52d 100644
--- a/include/class.ticket.php
+++ b/include/class.ticket.php
@@ -1660,6 +1660,9 @@ implements RestrictedAccess, Threadable, Searchable {
                 unset($recipients[$key]);
          }
 
+        if (!count($recipients))
+            return true;
+
         //see if the ticket user is a recipient
         if ($owner->getEmail()->address != $poster->getEmail()->address && !in_array($owner->getEmail()->address, $skip))
           $owner_recip = $owner->getEmail()->address;
-- 
GitLab