FIX: Prioritize VERP key over final_recipient header in bounced email

Per RFC3464 2.3.2, the final_recipient header may not match the address we originally sent the email to.
This commit is contained in:
David Taylor
2019-05-03 12:12:44 +01:00
parent 0d41d58d27
commit 0644c10bfe
3 changed files with 51 additions and 4 deletions

View File

@ -212,6 +212,14 @@ describe Email::Receiver do
expect(email_log_2.bounced).to eq(true)
end
it "works when the final recipient is different" do
expect { process(:verp_bounce_different_final_recipient) }.to raise_error(Email::Receiver::BouncedEmailError)
email_log.reload
expect(email_log.bounced).to eq(true)
expect(email_log.user.user_stat.bounce_score).to eq(SiteSetting.soft_bounce_score)
end
it "sends a system message once they reach the 'bounce_score_threshold'" do
expect(user.active).to eq(true)