diff --git a/include/class.mailfetch.php b/include/class.mailfetch.php index fb840216..6d8bddd3 100644 --- a/include/class.mailfetch.php +++ b/include/class.mailfetch.php @@ -235,11 +235,13 @@ function getHeaderInfo($mid) { return null; $sender=$headerinfo->from[0]; + $recipient=$headerinfo->to[0]; //Just what we need... - $header=array('name' =>@$sender->personal, - 'email' =>(strtolower($sender->mailbox).'@'.$sender->host), - 'subject'=>@$headerinfo->subject, - 'mid' =>$headerinfo->message_id + $header=array('name' =>@$sender->personal, + 'email' =>(strtolower($sender->mailbox).'@'.$sender->host), + 'recipient_email'=>(strtolower($recipient->mailbox).'@'.$recipient->host), + 'subject' =>@$headerinfo->subject, + 'mid' =>$headerinfo->message_id ); return $header; @@ -386,6 +388,7 @@ function createTicket($mid) { $var['name']=$this->mime_decode($mailinfo['name']); $var['email']=$mailinfo['email']; + $var['recipient_email']=$mailinfo['recipient_email']; $var['subject']=$mailinfo['subject']?$this->mime_decode($mailinfo['subject']):'[No Subject]'; $var['message']=Format::stripEmptyLines($this->getBody($mid)); $var['header']=$this->getHeader($mid); diff --git a/include/class.ticket.php b/include/class.ticket.php index da45d519..58db813c 100644 --- a/include/class.ticket.php +++ b/include/class.ticket.php @@ -1931,6 +1931,8 @@ function create($vars, &$errors, $origin, $autorespond=true, $alertstaff=true) { # function if (isset($vars['autorespond'])) $autorespond=$vars['autorespond']; + $vars['recipient_email'] = (isset($vars['recipient_email'])) ? $vars['recipient_email'] : '' ; + //Any error above is fatal. if($errors) return 0; @@ -1971,6 +1973,7 @@ function create($vars, &$errors, $origin, $autorespond=true, $alertstaff=true) { .' ,topic_id='.db_input($topicId) .' ,priority_id='.db_input($priorityId) .' ,email='.db_input($vars['email']) + .' ,recipient_email='.db_input($vars['recipient_email']) .' ,name='.db_input(Format::striptags($vars['name'])) .' ,subject='.db_input(Format::striptags($vars['subject'])) .' ,phone="'.db_input($vars['phone'],false).'"' diff --git a/include/upgrader/sql/recipient.patch.sql b/include/upgrader/sql/recipient.patch.sql new file mode 100644 index 00000000..7d6c04d8 --- /dev/null +++ b/include/upgrader/sql/recipient.patch.sql @@ -0,0 +1 @@ +ALTER TABLE `%TABLE_PREFIX%ticket` ADD `recipient_email` VARCHAR( 120 ) NOT NULL AFTER `email`