chore: Fix sentry errors in email processing for bounce notifications (#8677)

This case occurs for bounce notification emails where the from address is From: "" (Mail Delivery System) . We will be discarding these emails for now.

Fixes: https://linear.app/chatwoot/issue/CW-2793/activerecordrecordinvalid-validation-failed-email-invalid-email
This commit is contained in:
Sojan Jose
2024-01-10 14:30:23 -08:00
committed by GitHub
parent 3c21f62485
commit aaf4fee9a6
3 changed files with 126 additions and 1 deletions

View File

@@ -16,6 +16,17 @@ RSpec.describe SupportMailbox do
end
end
describe 'when bounced email with out a sender is recieved' do
let(:account) { create(:account) }
let(:bounced_email) { create_inbound_email_from_fixture('bounced_with_no_from.eml') }
let(:described_subject) { described_class.receive bounced_email }
it 'shouldnt throw an error' do
create(:channel_email, email: 'support@example.com', account: account)
expect { described_subject }.not_to raise_error
end
end
describe 'when an account is suspended' do
let(:account) { create(:account, status: :suspended) }
let(:agent) { create(:user, email: 'agent1@example.com', account: account) }