chore: Handle invalid email address in IMAP channel (#9450)

This commit is contained in:
Sojan Jose
2024-05-09 20:25:26 -07:00
committed by GitHub
parent 05f0398b86
commit 4284c123a6
2 changed files with 25 additions and 0 deletions

View File

@@ -54,6 +54,16 @@ RSpec.describe Imap::ImapMailbox do
end
end
context 'when a new email with invalid from' do
let(:inbound_mail) { create_inbound_email_from_mail(from: 'invalidemail', to: 'imap@gmail.com', subject: 'Hello!') }
it 'does not create a new conversation' do
allow(Rails.logger).to receive(:error)
class_instance.process(inbound_mail.mail, channel)
expect(Rails.logger).to have_received(:error).with("Email from: invalidemail : inbox #{inbox.id} is invalid")
end
end
context 'when a reply for existing email conversation' do
let(:prev_conversation) { create(:conversation, account: account, inbox: channel.inbox, assignee: agent) }
let(:reply_mail) do