aboutsummaryrefslogtreecommitdiffstats
path: root/script/handle-mail-replies
diff options
context:
space:
mode:
authorRobin Houston <robin.houston@gmail.com>2012-01-05 10:26:01 +0000
committerRobin Houston <robin.houston@gmail.com>2012-01-05 10:26:01 +0000
commit6a93d027e744bfc4ab2f8f7808ee99c770003481 (patch)
treeb8bfe4e93e2314c8c7c9b95e99a861d8fad6b05f /script/handle-mail-replies
parent48bbe41b36402a22b808ec860c1a84673b74527f (diff)
parentb06195a428b5cb6c3e95b07c631e2f18febf05f0 (diff)
Merge branch 'release/0.5' into wdtk
Conflicts: .gitignore
Diffstat (limited to 'script/handle-mail-replies')
-rwxr-xr-xscript/handle-mail-replies21
1 files changed, 18 insertions, 3 deletions
diff --git a/script/handle-mail-replies b/script/handle-mail-replies
index 9b1fb5b29..68cab9035 100755
--- a/script/handle-mail-replies
+++ b/script/handle-mail-replies
@@ -1,4 +1,5 @@
-#!/usr/bin/ruby
+#!/usr/bin/env ruby
+# -*- coding: utf-8 -*-
# Handle email responses sent to us.
#
@@ -17,8 +18,13 @@ load "config.rb"
MySociety::Config.set_file(File.join($alaveteli_dir, 'config', 'general'), true)
MySociety::Config.load_default
-$:.push(File.join($alaveteli_dir, "vendor", "rails", "actionmailer", "lib", "action_mailer", "vendor", "tmail-1.2.7"))
-require 'tmail'
+require 'rubygems'
+if File.exist? File.join($alaveteli_dir,'vendor','rails','Rakefile')
+ $:.push(File.join($alaveteli_dir, "vendor", "rails", "actionmailer", "lib", "action_mailer", "vendor", "tmail-1.2.7"))
+ require 'tmail'
+else
+ require 'action_mailer'
+end
def main(in_test_mode)
Dir.chdir($alaveteli_dir) do
@@ -114,12 +120,21 @@ def is_oof?(message)
end
end
+ if message.header_string("Auto-Submitted") == "auto-generated"
+ if subject =~ /out of( the)? office/
+ return true
+ end
+ end
+
if subject.start_with? "out of office autoreply:"
return true
end
if subject == "out of office"
return true
end
+ if subject == "out of office reply"
+ return true
+ end
if subject.end_with? "is out of the office"
return true
end