diff options
-rwxr-xr-x | script/handle-mail-replies | 3 | ||||
-rw-r--r-- | spec/fixtures/files/track-response-messagelabs-oof-1.email | 62 | ||||
-rw-r--r-- | spec/script/handle-mail-replies_spec.rb | 5 |
3 files changed, 70 insertions, 0 deletions
diff --git a/script/handle-mail-replies b/script/handle-mail-replies index 7304e0528..e0f18d166 100755 --- a/script/handle-mail-replies +++ b/script/handle-mail-replies @@ -112,6 +112,9 @@ def is_oof?(message) if subject.start_with? "Out of Office AutoReply:" return true end + if subject == "Out of Office" + return true + end if subject.end_with? "is out of the office" return true end diff --git a/spec/fixtures/files/track-response-messagelabs-oof-1.email b/spec/fixtures/files/track-response-messagelabs-oof-1.email new file mode 100644 index 000000000..7cd5d6b8d --- /dev/null +++ b/spec/fixtures/files/track-response-messagelabs-oof-1.email @@ -0,0 +1,62 @@ +Delivered-To: mysociety.robin@gmail.com +Received: by 10.216.187.197 with SMTP id y47cs96363wem; + Tue, 6 Sep 2011 13:24:49 -0700 (PDT) +Received: by 10.216.229.200 with SMTP id h50mr234738weq.32.1315340689299; + Tue, 06 Sep 2011 13:24:49 -0700 (PDT) +Return-Path: <rick.rollington@parliament.uk> +Received: from majestic.ukcod.org.uk (majestic.ukcod.org.uk [89.238.145.68]) + by mx.google.com with ESMTPS id j13si9391756wed.109.2011.09.06.13.24.48 + (version=TLSv1/SSLv3 cipher=OTHER); + Tue, 06 Sep 2011 13:24:49 -0700 (PDT) +Received-SPF: pass (google.com: domain of rick.rollington@parliament.uk designates 89.238.145.68 as permitted sender) client-ip=89.238.145.68; +Authentication-Results: mx.google.com; spf=pass (google.com: domain of rick.rollington@parliament.uk designates 89.238.145.68 as permitted sender) smtp.mail=rick.rollington@parliament.uk +Received: from mail82.messagelabs.com ([195.245.231.67]:4996) + by majestic.ukcod.org.uk with esmtp (Exim 4.72) + (envelope-from <rick.rollington@parliament.uk>) + id 1R12CI-000465-Gx + for team@whatdotheyknow.com; Tue, 06 Sep 2011 21:24:42 +0100 +X-Env-Sender: rick.rollington@parliament.uk +X-Msg-Ref: server-4.tower-82.messagelabs.com!1315340670!59450288!1 +X-Originating-IP: [194.60.38.7] +X-StarScan-Version: 6.3.6; banners=-,-,- +X-VirusChecked: Checked +Received: (qmail 4246 invoked from network); 6 Sep 2011 20:24:31 -0000 +Received: from hpux13x.parliament.uk (HELO hpux13x.parliament.uk) (194.60.38.7) + by server-4.tower-82.messagelabs.com with DHE-RSA-AES256-SHA encrypted SMTP; 6 Sep 2011 20:24:31 -0000 +Received: from MMEH001.parliament.uk (mmeh001.parliament.uk [10.100.70.11]) + by hpux13x.parliament.uk with ESMTP id p86KOKNw039771 + for <team@whatdotheyknow.com>; Tue, 6 Sep 2011 21:24:20 +0100 (BST) +Received: from MMEM001.parliament.uk ([169.254.1.45]) by MMEH001.parliament.uk + ([10.100.70.11]) with mapi; Tue, 6 Sep 2011 21:24:20 +0100 +From: "ROLLINGTON, Rick" <rick.rollington@parliament.uk> +To: WhatDoTheyKnow <team@whatdotheyknow.com> +Date: Tue, 6 Sep 2011 21:24:20 +0100 +Subject: Out of Office +Thread-Topic: Out of Office +Thread-Index: Acxs0vWVKlHifbrXTBmxr7r0Rh9bhwAAAAGd +Message-ID: <93A0DC80C8953B4B88DB2726AE921E264E8DE93980@MMEM001.parliament.uk> +Accept-Language: en-US, en-GB +Content-Language: en-US +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +acceptlanguage: en-US, en-GB +Content-Type: text/plain; charset="us-ascii" +Content-Transfer-Encoding: quoted-printable +MIME-Version: 1.0 +List-Id: Admin Team for What Do They Know <team@whatdotheyknow.com> + +Thank you for your email. + +I will be out of the office between xnd August and yth September. + +For urgent enquiries please email Paul the Pony at, paul.the.pony@parliame= +nt.uk + + +________________________________ +UK Parliament Disclaimer: +This e-mail is confidential to the intended recipient. If you have received= + it in error, please notify the sender and delete it from your system. Any = +unauthorised use, disclosure, or copying is not permitted. This e-mail has = +been checked for viruses, but no liability is accepted for any damage cause= +d by any virus transmitted by this e-mail.
\ No newline at end of file diff --git a/spec/script/handle-mail-replies_spec.rb b/spec/script/handle-mail-replies_spec.rb index b3e6e5dbb..451c66252 100644 --- a/spec/script/handle-mail-replies_spec.rb +++ b/spec/script/handle-mail-replies_spec.rb @@ -44,5 +44,10 @@ describe "When filtering" do r = mail_reply_test("track-response-lotus-oof-1.email") r.status.should == 2 end + + it "should detect a Messagelabs-style out-of-office" do + r = mail_reply_test("track-response-messagelabs-oof-1.email") + r.status.should == 2 + end end |