chore: consider X-original-sender to create contact in case of group mail (#2841)

For emails forwarded from google groups, Google rewrites the FROM address to the group email and the original email will be available under X-Original-Sender. This PR enables chatwoot to handle this case.

Fixes: #2715
This commit is contained in:
Tejaswini Chile
2021-08-24 14:18:08 +05:30
committed by GitHub
parent 6515b69560
commit 09e3413d10
4 changed files with 654 additions and 2 deletions

View File

@@ -63,5 +63,21 @@ RSpec.describe SupportMailbox, type: :mailbox do
expect(conversation.messages.last.sender.id).to eq(contact.id)
end
end
describe 'group email sender' do
let(:group_sender_support_mail) { create_inbound_email_from_fixture('group_sender_support.eml') }
let(:described_subject) { described_class.receive group_sender_support_mail }
before do
# this email is hardcoded eml fixture file that's why we are updating this
channel_email.email = 'support@chatwoot.com'
channel_email.save
end
it 'create new contact with original sender' do
described_subject
expect(conversation.contact.email).to eq(group_sender_support_mail.mail['X-Original-Sender'].value)
end
end
end
end