cattr_accessor :ignored_emails_headers
@@ignored_emails_headers = {
'X-Auto-Response-Suppress' => 'oof',
- 'Auto-Submitted' => /^auto-/
+ 'Auto-Submitted' => /^auto-(replied|generated)/
}
# Processes incoming emails
"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
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