From 5d045eab847d81d50ec47440bd5b095d0028aa4a Mon Sep 17 00:00:00 2001 From: Peter Rotich <peter@osticket.com> Date: Sun, 26 Jan 2014 21:10:56 +0000 Subject: [PATCH] Add routing to check if a message is a bounced reply --- include/class.filter.php | 1 + include/class.thread.php | 20 +++++++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/include/class.filter.php b/include/class.filter.php index a17962cf2..ffdd76b1d 100644 --- a/include/class.filter.php +++ b/include/class.filter.php @@ -866,6 +866,7 @@ class TicketFilter { $bounce_headers = array( 'From' => array('<MAILER-DAEMON@MAILER-DAEMON>', 'MAILER-DAEMON', '<>'), 'Subject' => array('DELIVERY FAILURE', 'DELIVERY STATUS', 'UNDELIVERABLE:'), + 'Return-Path' => '<>', ); foreach ($bounce_headers as $header => $find) { diff --git a/include/class.thread.php b/include/class.thread.php index 2fda4bcae..0151f8cf8 100644 --- a/include/class.thread.php +++ b/include/class.thread.php @@ -377,7 +377,25 @@ Class ThreadEntry { } function isAutoResponse() { - return $this->getEmailHeader()?TicketFilter::isAutoResponse($this->getEmailHeader()):false; + static $autoresp; + + if (!isset($autoresp)) + $autoresp = $this->getEmailHeader() ? TicketFilter::isAutoResponse($this->getEmailHeader()) : false; + + return $autoresp; + } + + function isAutoBounce() { + static $autobounce; + + if (!isset($autobounce)) + $autobounce = $this->getEmailHeader() ? TicketFilter::isAutoBounce($this->getEmailHeader()) : false; + + return $autobounce; + } + + function isAutoReply() { + return ($this->isAutoResponse() || $this->isAutoBounce()); } //Web uploads - caller is expected to format, validate and set any errors. -- GitLab