]> source.dussan.org Git - redmine.git/commitdiff
only ignore undesirable Auto-Submitted headers defined in RFC3834 (#16190)
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Wed, 2 Jul 2014 16:13:18 +0000 (16:13 +0000)
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Wed, 2 Jul 2014 16:13:18 +0000 (16:13 +0000)
Contributed by Felix Schäfer.

git-svn-id: http://svn.redmine.org/redmine/trunk@13206 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/mail_handler.rb
test/unit/mail_handler_test.rb

index 1b4600536a6956cd9647bda65613aac1f590989b..2e25a294f1d1746d6293ce441bb857da561409f2 100644 (file)
@@ -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
index 507ca1e85152f0a732b1e135883ea690d7479654..6c3aefc41b874c1123b842c1c43ae93e7cfe4d76 100644 (file)
@@ -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