FEATURE: add support for bounce emails

We now optionally add a Variable Email Return Path to every email we send.
This allows us to cleanly handle email bounces, which in turn will improve
deliverability.
This commit is contained in:
Sam
2016-04-18 17:13:41 +10:00
parent 9e25e4baa8
commit fad017d842
5 changed files with 44 additions and 0 deletions

View File

@ -77,6 +77,28 @@ describe Email::Sender do
email_sender.send
end
context "adds return_path correctly when no plus addressing" do
before do
SiteSetting.bounce_email = 'bounce@test.com'
end
When { email_sender.send }
Then {
expect(message.header[:return_path].to_s).to eq("bounce+#{EmailLog.last.bounce_key}@test.com")
}
end
context "adds return_path correctly with plus addressing" do
before do
SiteSetting.bounce_email = 'bounce+meta@test.com'
end
When { email_sender.send }
Then {
expect(message.header[:return_path].to_s).to eq("bounce+meta-#{EmailLog.last.bounce_key}@test.com")
}
end
context "adds a List-ID header to identify the forum" do
before do
category = Fabricate(:category, name: 'Name With Space')