diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-07-07 05:08:58 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-07-07 05:08:58 +0000 |
commit | 232edc62372730de6045e958821c16dee14ac65f (patch) | |
tree | 40059552692d15f6da0d2a27acff6cfc3907ff8d /app | |
parent | d4dd35a78c613278c57cbb7492054bc30536472b (diff) | |
download | redmine-232edc62372730de6045e958821c16dee14ac65f.tar.gz redmine-232edc62372730de6045e958821c16dee14ac65f.zip |
Ignore emails with "Auto-Submitted: auto-*" header (#11338).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9924 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r-- | app/models/mail_handler.rb | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/app/models/mail_handler.rb b/app/models/mail_handler.rb index 520183c66..4b86221f6 100644 --- a/app/models/mail_handler.rb +++ b/app/models/mail_handler.rb @@ -50,8 +50,8 @@ class MailHandler < ActionMailer::Base cattr_accessor :ignored_emails_headers @@ignored_emails_headers = { - 'X-Auto-Response-Suppress' => 'OOF', - 'Auto-Submitted' => 'auto-replied' + 'X-Auto-Response-Suppress' => 'oof', + 'Auto-Submitted' => /^auto-/ } # Processes incoming emails @@ -69,11 +69,14 @@ class MailHandler < ActionMailer::Base # Ignore auto generated emails self.class.ignored_emails_headers.each do |key, ignored_value| value = email.header[key] - if value && value.to_s.downcase == ignored_value.downcase - if logger && logger.info - logger.info "MailHandler: ignoring email with #{key}:#{value} header" + if value + value = value.to_s.downcase + if (ignored_value.is_a?(Regexp) && value.match(ignored_value)) || value == ignored_value + if logger && logger.info + logger.info "MailHandler: ignoring email with #{key}:#{value} header" + end + return false end - return false end end @user = User.find_by_mail(sender_email) if sender_email.present? |