From 797fcc172c7bae2be3c2cc532c84952add06722d Mon Sep 17 00:00:00 2001 From: yuri Date: Thu, 9 Apr 2015 14:06:11 +0300 Subject: [PATCH] email to lead: use reply to --- frontend/client/src/views/email/detail.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/frontend/client/src/views/email/detail.js b/frontend/client/src/views/email/detail.js index b1dda96462..bdcc8d89c4 100644 --- a/frontend/client/src/views/email/detail.js +++ b/frontend/client/src/views/email/detail.js @@ -66,7 +66,22 @@ Espo.define('Views.Email.Detail', 'Views.Detail', function (Dep) { } } - attributes.emailAddress = this.model.get('from'); + if (this.model.get('replyToString')) { + var str = this.model.get('replyToString'); + var p = (str.split(';'))[0]; + attributes.emailAddress = this.parseAddressFromStringAddress(p); + var fromName = this.parseNameFromStringAddress(p); + if (fromName) { + var firstName = fromName.split(' ').slice(0, -1).join(' '); + var lastName = fromName.split(' ').slice(-1).join(' '); + attributes.firstName = firstName; + attributes.lastName = lastName; + } + } + + if (!attributes.emailAddress) { + attributes.emailAddress = this.model.get('from'); + } attributes.emailId = this.model.id; this.notify('Loading...');