FIX: Ignore DMARC for emails sent to mailing list mirror

This commit is contained in:
Gerhard Schlager 2019-12-06 13:29:39 +01:00
parent 8a6421565e
commit c88797bf0e
3 changed files with 22 additions and 1 deletions

View File

@ -199,7 +199,7 @@ module Email
@hidden_reason_id ||=
if is_spam?
Post.hidden_reasons[:email_spam_header_found]
elsif auth_res_action == :hide
elsif !sent_to_mailinglist_mirror? && auth_res_action == :hide
Post.hidden_reasons[:email_authentication_result_header]
else
nil

View File

@ -1422,6 +1422,14 @@ describe Email::Receiver do
expect { process("mailinglist_unsubscribe") }.to_not change { ActionMailer::Base.deliveries.count }
end
it "ignores dmarc fails" do
expect { process("mailinglist_dmarc_fail") }.to change { Topic.count }
post = Topic.last.first_post
expect(post.hidden).to eq(false)
expect(post.hidden_reason_id).to be_nil
end
end
it "tries to fix unparsable email addresses in To and CC headers" do

View File

@ -0,0 +1,13 @@
Authentication-Results: example.com; dmarc=fail
From: alice@foo.com
To: list@example.com
Subject: mailinglist mirror
Date: Mon, 16 Oct 2017 09:18:32 +0100
Message-ID: <bddaa334ef93b5f3c7c3a42599330844@foo.com>
Precedence: list
List-Id: Example List <list@example.com>
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset="us-ascii"
Sender: list-bounces@example.com
I love Discourse's mailinglist mirror feature.