FIX: don't use 'Return-Path' header to determine whether the email was auto generated

This commit is contained in:
Régis Hanol 2016-02-01 10:21:58 +01:00
parent ce8c2d34d7
commit 27aaed0aa5
3 changed files with 0 additions and 12 deletions

View file

@ -92,7 +92,6 @@ module Email
end end
def is_auto_generated? def is_auto_generated?
@mail.return_path.blank? ||
@mail[:precedence].to_s[/list|junk|bulk|auto_reply/] || @mail[:precedence].to_s[/list|junk|bulk|auto_reply/] ||
@mail.header.to_s[/auto-(submitted|replied|generated)/] @mail.header.to_s[/auto-(submitted|replied|generated)/]
end end

View file

@ -29,10 +29,6 @@ describe Email::Receiver do
expect { Email::Receiver.new(email(:missing_message_id)) }.to raise_error(Email::Receiver::NoMessageIdError) expect { Email::Receiver.new(email(:missing_message_id)) }.to raise_error(Email::Receiver::NoMessageIdError)
end end
it "raises an AutoGeneratedEmailError when the mail has no return path" do
expect { process(:no_return_path) }.to raise_error(Email::Receiver::AutoGeneratedEmailError)
end
it "raises an AutoGeneratedEmailError when the mail is auto generated" do it "raises an AutoGeneratedEmailError when the mail is auto generated" do
expect { process(:auto_generated_precedence) }.to raise_error(Email::Receiver::AutoGeneratedEmailError) expect { process(:auto_generated_precedence) }.to raise_error(Email::Receiver::AutoGeneratedEmailError)
expect { process(:auto_generated_header) }.to raise_error(Email::Receiver::AutoGeneratedEmailError) expect { process(:auto_generated_header) }.to raise_error(Email::Receiver::AutoGeneratedEmailError)

View file

@ -1,7 +0,0 @@
From: Foo Bar <foo@bar.com>
Date: Fri, 15 Jan 2016 00:12:43 +0100
Message-ID: <1@foo.bar.mail>
Precedence: list
Mime-Version: 1.0
Content-Type: text/plain
Content-Transfer-Encoding: 7bit