FIX: email receiver should ignore x-auto-response-suppress

This header is used by Microsoft Exchange to indicate when certain types of
autoresponses should not be generated for an email.

It triggers our "is this mail autogenerated?" detection, but should not be used
for this purpose.
This commit is contained in:
Michael Brown
2023-05-03 12:17:19 -04:00
parent 6ce1fbc479
commit 076def505e
3 changed files with 15 additions and 1 deletions

View File

@ -521,6 +521,10 @@ RSpec.describe Email::Receiver do
expect { process(:invalid_from_2) }.to raise_error(Email::Receiver::NoSenderDetectedError)
end
it "doesn't raise an AutoGeneratedEmailError due to an X-Auto-Response-Suppress header" do
expect { process(:quirks_exchange_xars) }.to change { topic.posts.count }
end
it "doesn't raise an AutoGeneratedEmailError when the mail is auto generated but is allowlisted" do
SiteSetting.auto_generated_allowlist = "foo@bar.com|discourse@bar.com"
expect { process(:auto_generated_allowlisted) }.to change { topic.posts.count }