Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Saving recipient from email #202

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions include/class.mailfetch.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
3 changes: 3 additions & 0 deletions include/class.ticket.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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).'"'
Expand Down
1 change: 1 addition & 0 deletions include/upgrader/sql/recipient.patch.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE `%TABLE_PREFIX%ticket` ADD `recipient_email` VARCHAR( 120 ) NOT NULL AFTER `email`