diff options
author | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2014-07-02 16:13:18 +0000 |
---|---|---|
committer | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2014-07-02 16:13:18 +0000 |
commit | 4b55bb913c48db9ccd1413875f52ea4b5e21a503 (patch) | |
tree | dd08f65d0b96b5119b1939492341f874d3cff31a | |
parent | f6abc06eeea40c69896709c08f4ade4277280d78 (diff) | |
download | redmine-4b55bb913c48db9ccd1413875f52ea4b5e21a503.tar.gz redmine-4b55bb913c48db9ccd1413875f52ea4b5e21a503.zip |
only ignore undesirable Auto-Submitted headers defined in RFC3834 (#16190)
Contributed by Felix Schäfer.
git-svn-id: http://svn.redmine.org/redmine/trunk@13206 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r-- | app/models/mail_handler.rb | 2 | ||||
-rw-r--r-- | test/unit/mail_handler_test.rb | 16 |
2 files changed, 15 insertions, 3 deletions
diff --git a/app/models/mail_handler.rb b/app/models/mail_handler.rb index 1b4600536..2e25a294f 100644 --- a/app/models/mail_handler.rb +++ b/app/models/mail_handler.rb @@ -74,7 +74,7 @@ class MailHandler < ActionMailer::Base cattr_accessor :ignored_emails_headers @@ignored_emails_headers = { 'X-Auto-Response-Suppress' => 'oof', - 'Auto-Submitted' => /^auto-/ + 'Auto-Submitted' => /^auto-(replied|generated)/ } # Processes incoming emails diff --git a/test/unit/mail_handler_test.rb b/test/unit/mail_handler_test.rb index 507ca1e85..6c3aefc41 100644 --- a/test/unit/mail_handler_test.rb +++ b/test/unit/mail_handler_test.rb @@ -637,8 +637,7 @@ class MailHandlerTest < ActiveSupport::TestCase "X-Auto-Response-Suppress: OOF", "Auto-Submitted: auto-replied", "Auto-Submitted: Auto-Replied", - "Auto-Submitted: auto-generated", - "Auto-Submitted: auto-forwarded" + "Auto-Submitted: auto-generated" ].each do |header| raw = IO.read(File.join(FIXTURES_PATH, 'ticket_on_given_project.eml')) raw = header + "\n" + raw @@ -649,6 +648,19 @@ class MailHandlerTest < ActiveSupport::TestCase end end + test "should not ignore Auto-Submitted headers not defined in RFC3834" do + [ + "Auto-Submitted: auto-forwarded" + ].each do |header| + raw = IO.read(File.join(FIXTURES_PATH, 'ticket_on_given_project.eml')) + raw = header + "\n" + raw + + assert_difference 'Issue.count', 1 do + assert_not_nil MailHandler.receive(raw), "email with #{header} header was ignored" + end + end + end + def test_add_issue_should_send_email_notification Setting.notified_events = ['issue_added'] ActionMailer::Base.deliveries.clear |