email replyTo

This commit is contained in:
yuri
2015-09-03 11:05:20 +03:00
parent 468a236ce1
commit e5b46bc547
6 changed files with 84 additions and 15 deletions
+11 -5
View File
@@ -91,10 +91,12 @@ class Importer
$toArr = $this->getAddressListFromMessage($message, 'to');
$ccArr = $this->getAddressListFromMessage($message, 'cc');
$replyToArr = $this->getAddressListFromMessage($message, 'replyTo');
$email->set('from', $fromArr[0]);
$email->set('to', implode(';', $toArr));
$email->set('cc', implode(';', $ccArr));
$email->set('replyTo', implode(';', $replyToArr));
if ($this->getFiltersMatcher()->match($email, $filterList)) {
return false;
@@ -200,10 +202,15 @@ class Importer
if ($from) {
$parentFound = $this->findParent($email, $from);
}
if (!$parentFound) {
if (!empty($toArr)) {
$parentFound = $this->findParent($email, $toArr[0]);
}
}
if (!$parentFound) {
if (!empty($replyToArr)) {
$parentFound = $this->findParent($email, $replyToArr[0]);
}
}
if (!$parentFound) {
if (!empty($toArr)) {
$parentFound = $this->findParent($email, $toArr[0]);
}
}
@@ -268,7 +275,6 @@ class Importer
{
$addressList = array();
if (isset($message->$type)) {
$list = $message->getHeader($type)->getAddressList();
foreach ($list as $address) {
$addressList[] = $address->getEmail();
+10
View File
@@ -206,6 +206,16 @@ class Sender
}
}
$value = $email->get('replyTo');
if ($value) {
$arr = explode(';', $value);
if (is_array($arr)) {
foreach ($arr as $address) {
$message->addReplyTo(trim($address));
}
}
}
$attachmentPartList = array();
$attachmentCollection = $email->get('attachments');
$attachmentInlineCollection = $email->getInlineAttachments();
+48
View File
@@ -99,5 +99,53 @@ class Email extends \Espo\Core\ORM\Entity
}
return $attachmentList;
}
public function getToList()
{
$value = $email->get('to');
if ($value) {
$arr = explode(';', $value);
if (is_array($arr)) {
return $arr;
}
}
return [];
}
public function getCcList()
{
$value = $email->get('cc');
if ($value) {
$arr = explode(';', $value);
if (is_array($arr)) {
return $arr;
}
}
return [];
}
public function getBccList()
{
$value = $email->get('bcc');
if ($value) {
$arr = explode(';', $value);
if (is_array($arr)) {
return $arr;
}
}
return [];
}
public function getReplyToList()
{
$value = $email->get('replyTo');
if ($value) {
$arr = explode(';', $value);
if (is_array($arr)) {
return $arr;
}
}
return [];
}
}
+4 -1
View File
@@ -124,7 +124,7 @@ class Email extends \Espo\Core\ORM\Repositories\RDB
}
}
if ($entity->has('from') || $entity->has('to') || $entity->has('cc') || $entity->has('bcc')) {
if ($entity->has('from') || $entity->has('to') || $entity->has('cc') || $entity->has('bcc') || $entity->has('replyTo')) {
if (!$entity->has('usersIds')) {
$entity->loadLinkMultipleField('users');
}
@@ -151,6 +151,9 @@ class Email extends \Espo\Core\ORM\Repositories\RDB
if ($entity->has('bcc')) {
$this->prepareAddressess($entity, 'bcc');
}
if ($entity->has('replyTo')) {
$this->prepareAddressess($entity, 'replyTo');
}
$usersIds = $entity->get('usersIds');
$assignedUserId = $entity->get('assignedUserId');
@@ -8,6 +8,8 @@
"to": "To",
"cc": "CC",
"bcc": "BCC",
"replyTo": "Reply To",
"replyToString": "Reply To (String)",
"isHtml": "Is Html",
"body": "Body",
"subject": "Subject",
@@ -7,7 +7,6 @@
"subject": {
"type": "varchar",
"required": true,
"db": false,
"notStorable": true,
"view": "Email.Fields.Subject"
},
@@ -22,29 +21,30 @@
},
"from": {
"type": "varchar",
"db": false,
"notStorable": true,
"required": true,
"view": "Email.Fields.FromAddressVarchar"
"view": "views/email/fields/from-address-varchar"
},
"to": {
"type": "varchar",
"db": false,
"notStorable": true,
"required": true,
"view": "Email.Fields.EmailAddressVarchar"
"view": "views/email/fields/email-address-varchar"
},
"cc": {
"type": "varchar",
"db": false,
"notStorable": true,
"view": "Email.Fields.EmailAddressVarchar"
"view": "views/email/fields/email-address-varchar"
},
"bcc": {
"type": "varchar",
"db": false,
"notStorable": true,
"view": "Email.Fields.EmailAddressVarchar"
"view": "views/email/fields/email-address-varchar"
},
"replyTo": {
"type": "varchar",
"notStorable": true,
"view": "views/email/fields/email-address-varchar"
},
"personStringData": {
"type": "varchar",