@@ -54,6 +54,13 class MailHandler < ActionMailer::Base | |||
|
54 | 54 | end |
|
55 | 55 | return false |
|
56 | 56 | end |
|
57 | # Ignore out-of-office emails | |
|
58 | if email.header_string("X-Auto-Response-Suppress") == 'OOF' | |
|
59 | if logger && logger.info | |
|
60 | logger.info "MailHandler: ignoring out-of-office email" | |
|
61 | end | |
|
62 | return false | |
|
63 | end | |
|
57 | 64 | @user = User.find_by_mail(sender_email) if sender_email.present? |
|
58 | 65 | if @user && !@user.active? |
|
59 | 66 | if logger && logger.info |
@@ -359,6 +359,15 class MailHandlerTest < ActiveSupport::TestCase | |||
|
359 | 359 | end |
|
360 | 360 | end |
|
361 | 361 | |
|
362 | def test_should_ignore_oof_emails | |
|
363 | raw = IO.read(File.join(FIXTURES_PATH, 'ticket_on_given_project.eml')) | |
|
364 | raw = "X-Auto-Response-Suppress: OOF\n" + raw | |
|
365 | ||
|
366 | assert_no_difference 'Issue.count' do | |
|
367 | assert_equal false, MailHandler.receive(raw) | |
|
368 | end | |
|
369 | end | |
|
370 | ||
|
362 | 371 | def test_add_issue_should_send_email_notification |
|
363 | 372 | Setting.notified_events = ['issue_added'] |
|
364 | 373 | ActionMailer::Base.deliveries.clear |
General Comments 0
You need to be logged in to leave comments.
Login now