diff --git a/app/assets/javascripts/app/lib/app_post/utils.coffee b/app/assets/javascripts/app/lib/app_post/utils.coffee index 85756ceca..6b7c21eef 100644 --- a/app/assets/javascripts/app/lib/app_post/utils.coffee +++ b/app/assets/javascripts/app/lib/app_post/utils.coffee @@ -932,7 +932,7 @@ class App.Utils # if sender is customer but in article.from is no email, try to get # customers email via customer user - if articleNew.to && !articleNew.to.match(/@/) + if (articleNew.to && !articleNew.to.match(/@/)) || !articleNew.to articleNew.to = ticket.customer.email return articleNew diff --git a/public/assets/tests/html_utils.js b/public/assets/tests/html_utils.js index 1e2ebe41e..4c60dd4f6 100644 --- a/public/assets/tests/html_utils.js +++ b/public/assets/tests/html_utils.js @@ -1814,7 +1814,7 @@ test('check getRecipientArticle format', function() { }, } result = { - to: '', + to: customer.email, cc: '', body: '', in_reply_to: 'message_id2', @@ -1839,6 +1839,7 @@ test('check getRecipientArticle format', function() { sender: { name: 'Agent', }, + from: 'article_created_by@example.com', created_by: { login: 'login', firstname: 'firstname', @@ -1847,7 +1848,7 @@ test('check getRecipientArticle format', function() { }, } result = { - to: '', + to: customer.email, cc: '', body: '', in_reply_to: 'message_id3',