feat: Route emails based on x-original-to in email channel (#6901)
Fixes: #6608 ref: https://linear.app/chatwoot/issue/CW-30/emails-not-routed-based-on-x-original-to
This commit is contained in:
@@ -31,6 +31,30 @@ describe ::EmailChannelFinder do
|
||||
channel = described_class.new(reply_mail.mail).perform
|
||||
expect(channel).to eq(channel_email)
|
||||
end
|
||||
|
||||
it 'return channel with cc email' do
|
||||
channel_email.update(email: 'test@example.com')
|
||||
reply_mail.mail['to'] = nil
|
||||
reply_mail.mail['cc'] = 'test@example.com'
|
||||
channel = described_class.new(reply_mail.mail).perform
|
||||
expect(channel).to eq(channel_email)
|
||||
end
|
||||
|
||||
it 'return channel with bcc email' do
|
||||
channel_email.update(email: 'test@example.com')
|
||||
reply_mail.mail['to'] = nil
|
||||
reply_mail.mail['bcc'] = 'test@example.com'
|
||||
channel = described_class.new(reply_mail.mail).perform
|
||||
expect(channel).to eq(channel_email)
|
||||
end
|
||||
|
||||
it 'return channel with X-Original-To email' do
|
||||
channel_email.update(email: 'test@example.com')
|
||||
reply_mail.mail['to'] = nil
|
||||
reply_mail.mail['X-Original-To'] = 'test@example.com'
|
||||
channel = described_class.new(reply_mail.mail).perform
|
||||
expect(channel).to eq(channel_email)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user