From 5537b648010466fadbca591c3a47915a568b5257 Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Mon, 26 May 2014 13:29:37 -0500
Subject: [PATCH] mail: Add useful error log on failed mail processing

---
 include/class.mailfetch.php | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/include/class.mailfetch.php b/include/class.mailfetch.php
index 7bddd9ef0..0958e8be1 100644
--- a/include/class.mailfetch.php
+++ b/include/class.mailfetch.php
@@ -728,11 +728,18 @@ class MailFetcher {
                 return true;
             }
 
-            //TODO: Log error..
+            // Log an error to the system logs
+            $mailbox = Email::lookup($vars['emailId']);
+            $ost->logError('Mail Processing Exception', sprintf(
+                "Mailbox: %s\nError(s): %s",
+                $mailbox->getEmail(),
+                print_r($errors, true)
+            ), false);
+
+            // Indicate failure of mail processing
             return null;
         }
 
-
         return $ticket;
     }
 
-- 
GitLab