diff --git a/include/class.filter.php b/include/class.filter.php index ad0b46ee5f717c6f23a5a2938db499c43051910d..80081aa8ace454e5d1368b60522e4263ae6188bd 100644 --- a/include/class.filter.php +++ b/include/class.filter.php @@ -824,13 +824,16 @@ class TicketFilter { $headers = Mail_Parse::splitHeaders($headers); $auto_headers = array( - 'Auto-Submitted' => 'AUTO-REPLIED', + 'Auto-Submitted' => array('AUTO-REPLIED', 'AUTO-GENERATED'), 'Precedence' => array('AUTO_REPLY', 'BULK', 'JUNK', 'LIST'), - 'Subject' => array('OUT OF OFFICE', 'AUTO-REPLY:', 'AUTORESPONSE'), + 'X-Precedence' => array('AUTO_REPLY', 'BULK', 'JUNK', 'LIST'), 'X-Autoreply' => 'YES', 'X-Auto-Response-Suppress' => array('ALL', 'DR', 'RN', 'NRN', 'OOF', 'AutoReply'), - 'X-Autoresponse' => '', - 'X-Auto-Reply-From' => '' + 'X-Autoresponse' => '*', + 'X-AutoReply-From' => '*', + 'X-Autorespond' => '*', + 'X-Mail-Autoreply' => '*', + 'X-Autogenerated' => 'REPLY', ); foreach ($auto_headers as $header=>$find) { @@ -846,19 +849,17 @@ class TicketFilter { foreach ($find as $f) if (strpos($value, $f) === 0) return true; + } elseif ($find === '*') { + return true; } elseif (strpos($value, $find) === 0) { return true; } } - # Bounces also counts as auto-responses. - if(self::isBounce($headers)) - return true; - return false; } - function isBounce($headers) { + static function isBounce($headers) { if($headers && !is_array($headers)) $headers = Mail_Parse::splitHeaders($headers); @@ -867,15 +868,17 @@ class TicketFilter { 'From' => array('stripos', array('MAILER-DAEMON', '<>'), null, false), 'Subject' => array('stripos', - array('DELIVERY FAILURE', 'DELIVERY STATUS', 'UNDELIVERABLE:'), 0), + array('DELIVERY FAILURE', 'DELIVERY STATUS', + 'UNDELIVERABLE:', 'Undelivered Mail Returned'), 0), 'Return-Path' => array('strcmp', array('<>'), 0), 'Content-Type' => array('stripos', array('report-type=delivery-status'), null, false), + 'X-Failed-Recipients' => array('strpos', array('@'), null, false) ); foreach ($bounce_headers as $header => $find) { if(!isset($headers[$header])) continue; - list($func, $searches, $pos, $neg) = $find; + @list($func, $searches, $pos, $neg) = $find; if(!($value = $headers[$header]) || !is_array($searches)) continue; diff --git a/include/class.mailparse.php b/include/class.mailparse.php index 3356cb9bf1a596272d3e46e9a2cb72dfc0c41ca5..687efa0ee76cf8fdd7632af12fa7436494ba1dea 100644 --- a/include/class.mailparse.php +++ b/include/class.mailparse.php @@ -96,7 +96,7 @@ class Mail_Parse { foreach ($headers as $hdr) { list($name, $val) = explode(": ", $hdr, 2); # Create list of values if header is specified more than once - if ($array[$name] && $as_array) { + if (isset($array[$name]) && $as_array) { if (is_array($array[$name])) $array[$name][] = $val; else $array[$name] = array($array[$name], $val); } else {