Skip to content
Snippets Groups Projects
Commit c7c12886 authored by Jared Hancock's avatar Jared Hancock
Browse files

email: Fetch headers from db for bounce detection

parent 6986e6f7
No related branches found
No related tags found
No related merge requests found
...@@ -240,7 +240,7 @@ Class ThreadEntry { ...@@ -240,7 +240,7 @@ Class ThreadEntry {
if(!$id && !($id=$this->getId())) if(!$id && !($id=$this->getId()))
return false; return false;
$sql='SELECT thread.*, info.email_mid ' $sql='SELECT thread.*, info.email_mid, info.headers '
.' ,count(DISTINCT attach.attach_id) as attachments ' .' ,count(DISTINCT attach.attach_id) as attachments '
.' FROM '.TICKET_THREAD_TABLE.' thread ' .' FROM '.TICKET_THREAD_TABLE.' thread '
.' LEFT JOIN '.TICKET_EMAIL_INFO_TABLE.' info .' LEFT JOIN '.TICKET_EMAIL_INFO_TABLE.' info
...@@ -333,21 +333,21 @@ Class ThreadEntry { ...@@ -333,21 +333,21 @@ Class ThreadEntry {
return $this->ht['email_mid']; return $this->ht['email_mid'];
} }
function getEmailHeaders() { function getEmailHeaderArray() {
require_once(INCLUDE_DIR.'class.mailparse.php'); require_once(INCLUDE_DIR.'class.mailparse.php');
$sql = 'SELECT headers FROM '.TICKET_EMAIL_INFO_TABLE if (!isset($this->ht['@headers']))
.' WHERE message_id='.$this->getId(); $this->ht['@headers'] = Mail_Parse::splitHeaders($this->ht['headers']);
$headers = db_result(db_query($sql));
return Mail_Parse::splitHeaders($headers); return $this->ht['@headers'];
} }
function getEmailReferences() { function getEmailReferences() {
if (!isset($this->_references)) { if (!isset($this->_references)) {
$this->_references = $this->getEmailMessageId(); $headers = self::getEmailHeaderArray();
$headers = self::getEmailHeaders(); if (isset($headers['References']) && $headers['References'])
if (isset($headers['References'])) $this->_references = $headers['References']." ";
$this->_references .= " ".$headers['References']; $this->_references .= $this->getEmailMessageId();
} }
return $this->_references; return $this->_references;
} }
...@@ -379,8 +379,8 @@ Class ThreadEntry { ...@@ -379,8 +379,8 @@ Class ThreadEntry {
function isAutoReply() { function isAutoReply() {
if (!isset($this->is_autoreply)) if (!isset($this->is_autoreply))
$this->is_autoreply = $this->getEmailHeader() $this->is_autoreply = $this->getEmailHeaderArray()
? TicketFilter::isAutoReply($this->getEmailHeader()) : false; ? TicketFilter::isAutoReply($this->getEmailHeaderArray()) : false;
return $this->is_autoreply; return $this->is_autoreply;
} }
...@@ -388,8 +388,8 @@ Class ThreadEntry { ...@@ -388,8 +388,8 @@ Class ThreadEntry {
function isBounce() { function isBounce() {
if (!isset($this->is_bounce)) if (!isset($this->is_bounce))
$this->is_bounce = $this->getEmailHeader() $this->is_bounce = $this->getEmailHeaderArray()
? TicketFilter::isBounce($this->getEmailHeader()) : false; ? TicketFilter::isBounce($this->getEmailHeaderArray()) : false;
return $this->is_bounce; return $this->is_bounce;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment