diff options
-rw-r--r-- | app/controllers/admin_user_controller.rb | 12 | ||||
-rw-r--r-- | app/models/incoming_message.rb | 2 | ||||
-rw-r--r-- | app/views/admin_user/show.rhtml | 11 | ||||
-rw-r--r-- | app/views/admin_user/show_bounce_message.rhtml | 3 | ||||
-rw-r--r-- | config/routes.rb | 2 | ||||
-rwxr-xr-x | script/handle-mail-replies | 33 | ||||
-rw-r--r-- | spec/fixtures/files/track-response-exchange-oof-1.email | 102 | ||||
-rw-r--r-- | spec/fixtures/files/track-response-generic-oof.email | 8 | ||||
-rw-r--r-- | spec/fixtures/files/track-response-lotus-oof-1.email | 58 | ||||
-rw-r--r-- | spec/fixtures/files/track-response-messageclass-oof.email | 63 | ||||
-rw-r--r-- | spec/fixtures/files/track-response-messagelabs-oof-1.email | 62 | ||||
-rw-r--r-- | spec/script/handle-mail-replies_spec.rb | 25 |
12 files changed, 372 insertions, 9 deletions
diff --git a/app/controllers/admin_user_controller.rb b/app/controllers/admin_user_controller.rb index 404c4c3fe..5d90e74fe 100644 --- a/app/controllers/admin_user_controller.rb +++ b/app/controllers/admin_user_controller.rb @@ -28,6 +28,10 @@ class AdminUserController < AdminController # Don't use @user as that is any logged in user @admin_user = User.find(params[:id]) end + + def show_bounce_message + @admin_user = User.find(params[:id]) + end def edit @admin_user = User.find(params[:id]) @@ -57,6 +61,14 @@ class AdminUserController < AdminController flash[:notice] = 'Track destroyed' redirect_to user_admin_url(track_thing.tracking_user) end + + def clear_bounce + user = User.find(params[:id]) + user.email_bounced_at = nil + user.email_bounce_message = "" + user.save! + redirect_to user_admin_url(user) + end def login_as @admin_user = User.find(params[:id]) # check user does exist diff --git a/app/models/incoming_message.rb b/app/models/incoming_message.rb index c19f1b6e3..2b795ddf5 100644 --- a/app/models/incoming_message.rb +++ b/app/models/incoming_message.rb @@ -1304,7 +1304,7 @@ class IncomingMessage < ActiveRecord::Base prefix = email prefix =~ /^(.*)@/ prefix = $1 - if !prefix.nil? && prefix.downcase.match(/^(postmaster|mailer-daemon|auto_reply|donotreply|no.reply)$/) + if !prefix.nil? && prefix.downcase.match(/^(postmaster|mailer-daemon|auto_reply|do.?not.?reply|no.reply)$/) return false end if !self.mail['return-path'].nil? && self.mail['return-path'].addr == "<>" diff --git a/app/views/admin_user/show.rhtml b/app/views/admin_user/show.rhtml index 18d23fe73..4af79e45a 100644 --- a/app/views/admin_user/show.rhtml +++ b/app/views/admin_user/show.rhtml @@ -13,18 +13,25 @@ <% end %> -<p> +<div> <strong>Id:</strong> <%= @admin_user.id%> <br> <% for column in User.content_columns %> <strong><%= column.human_name %>:</strong> <% if column.name == 'email' %> <a href="mailto:<%=h @admin_user.email %>"><%=h @admin_user.email%></a> + <% elsif column.name == 'email_bounce_message' %> + <% if !@admin_user.email_bounce_message.empty? %> + <a href="../show_bounce_message/<%= @admin_user.id.to_s %>">See bounce message</a> + <% end %> <% else %> <%=h @admin_user.send(column.name) %> <% end %> + <% if column.name == 'email_bounced_at' && !@admin_user.email_bounced_at.nil? %> + <form action="../clear_bounce/<%= @admin_user.id.to_s %>" style="display: inline;"><input type="submit" name="action" value="Clear bounce"></form> + <% end %> <br> <% end %> -</p> +</div> <p> <%= link_to 'Public page', main_url(user_url(@admin_user)) %> diff --git a/app/views/admin_user/show_bounce_message.rhtml b/app/views/admin_user/show_bounce_message.rhtml new file mode 100644 index 000000000..ad643a13e --- /dev/null +++ b/app/views/admin_user/show_bounce_message.rhtml @@ -0,0 +1,3 @@ +<h1>Email bounce message for <%= @admin_user.name %></h1> + +<pre><%= @admin_user.email_bounce_message %></pre> diff --git a/config/routes.rb b/config/routes.rb index fcdc70d2e..3dfa30d5a 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -206,7 +206,9 @@ ActionController::Routing::Routes.draw do |map| user.admin_user_list_banned '/admin/user/banned', :action => 'list_banned' user.admin_user_show '/admin/user/show/:id', :action => 'show' user.admin_user_edit '/admin/user/edit/:id', :action => 'edit' + user.admin_user_show '/admin/user/show_bounce_message/:id', :action => 'show_bounce_message' user.admin_user_update '/admin/user/update/:id', :action => 'update' + user.admin_user_clear_bounce '/admin/user/clear_bounce/:id', :action => 'clear_bounce' user.admin_user_destroy_track '/admin/user/destroy_track', :action => 'destroy_track' user.admin_user_login_as '/admin/user/login_as/:id', :action => 'login_as' user.admin_clear_profile_photo '/admin/user/clear_profile_photo/:id', :action => 'clear_profile_photo' diff --git a/script/handle-mail-replies b/script/handle-mail-replies index 93cdc8cfd..9b1fb5b29 100755 --- a/script/handle-mail-replies +++ b/script/handle-mail-replies @@ -17,12 +17,19 @@ 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' + def main(in_test_mode) Dir.chdir($alaveteli_dir) do - load_rails - raw_message = $stdin.read - message = TMail::Mail.parse(raw_message) + begin + message = TMail::Mail.parse(raw_message) + rescue + # Error parsing message. Just pass it on, to be on the safe side. + forward_on(raw_message) unless in_test_mode + return 0 + end pfas = permanently_failed_addresses(message) if !pfas.empty? @@ -93,16 +100,29 @@ end def is_oof?(message) # Check for out-of-office + if message.header_string("X-POST-MessageClass") == "9; Autoresponder" + return true + end + + subject = message.header_string("Subject").downcase if message.header_string("Return-Path") == "<>" - subject = message.header_string("Subject") - if subject.start_with? "Out of Office: " + if subject.start_with? "out of office: " return true end - if subject.start_with? "Automatic reply: " + if subject.start_with? "automatic reply: " 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.end_with? "is out of the office" + return true + end return false end @@ -120,6 +140,7 @@ def load_rails end def record_bounce(email_address, bounce_message) + load_rails User.record_bounce_for_email(email_address, bounce_message) end diff --git a/spec/fixtures/files/track-response-exchange-oof-1.email b/spec/fixtures/files/track-response-exchange-oof-1.email new file mode 100644 index 000000000..6bb696119 --- /dev/null +++ b/spec/fixtures/files/track-response-exchange-oof-1.email @@ -0,0 +1,102 @@ +Delivered-To: mysociety.robin@gmail.com +Received: by 10.216.187.197 with SMTP id y47cs73028wem; + Tue, 6 Sep 2011 00:02:08 -0700 (PDT) +Received: by 10.216.229.167 with SMTP id h39mr1763951weq.57.1315292527401; + Tue, 06 Sep 2011 00:02:07 -0700 (PDT) +Return-Path: <Firstname.Surname@example.com> +Received: from wildfire.ukcod.org.uk (wildfire.ukcod.org.uk [89.238.145.74]) + by mx.google.com with ESMTPS id i56si7850683wed.12.2011.09.06.00.02.05 + (version=TLSv1/SSLv3 cipher=OTHER); + Tue, 06 Sep 2011 00:02:06 -0700 (PDT) +Received-SPF: neutral (google.com: 89.238.145.74 is neither permitted nor denied by domain of Firstname.Surname@example.com) client-ip=89.238.145.74; +Authentication-Results: mx.google.com; spf=neutral (google.com: 89.238.145.74 is neither permitted nor denied by domain of Firstname.Surname@example.com) smtp.mail=Firstname.Surname@example.com +Received: from gweuoutb1.linde.com ([94.100.245.173]:15826) + by wildfire.ukcod.org.uk with esmtp (Exim 4.69) + (envelope-from <Firstname.Surname@example.com>) + id 1R0pfT-00074Q-Bb + for team@whatdotheyknow.com; Tue, 06 Sep 2011 08:01:59 +0100 +X-IronPort-AV: E=Sophos;i="4.68,337,1312149600"; + d="scan'208,217";a="16336258" +X-Header: No Trailer +Received: from unknown (HELO mlgmuc00mail099.boc.com) ([10.138.224.206]) + by gweub1.linde.grp with ESMTP; 06 Sep 2011 09:01:48 +0200 +Received: from mlgmuc00mail096.boc.com ([10.138.224.203]) by mlgmuc00mail099.boc.com with Microsoft SMTPSVC(6.0.3790.4675); + Tue, 6 Sep 2011 09:02:24 +0200 +Received: from VSUK4EX01.eu.boc.com ([172.18.77.27]) by mlgmuc00mail096.boc.com with Microsoft SMTPSVC(6.0.3790.4675); + Tue, 6 Sep 2011 09:01:32 +0200 +Content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----_=_NextPart_001_01CC6C62.CEC3EF3C" +Subject: Out of Office AutoReply: Was the response you got to your FOI request any good? +X-MimeOLE: Produced By Microsoft Exchange V6.5 +Date: Tue, 6 Sep 2011 08:01:31 +0100 +Message-ID: <E75A6D7A72D76346A4BF6A27672C39AB11BFF525@VSUK4EX01.eu.boc.com> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: Was the response you got to your FOI request any good? +Thread-Index: AcxsYs6PUz9cAAJDScO38LEWgNj/CQAAAA2I +From: "Surname,Firstname" <Firstname.Surname@example.com> +To: "WhatDoTheyKnow" <team@whatdotheyknow.com> +X-OriginalArrivalTime: 06 Sep 2011 07:01:32.0883 (UTC) FILETIME=[CF626A30:01CC6C62] +List-Id: Admin Team for What Do They Know <team@whatdotheyknow.com> + +This is a multi-part message in MIME format. + +------_=_NextPart_001_01CC6C62.CEC3EF3C +Content-Type: text/plain; charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable + +I am out of the office and have limited access to my emails until Thursday = +nth Bartember. If you have an urgent query the please telephone me on 1234= +5678. + + +The information contained in this email and any attachments may be confiden= +tial and is provided solely for the use of the intended recipient(s). If yo= +u are not the intended recipient, you are hereby notified that any disclosu= +re, distribution, or use of this e-mail, its attachments or any information= + contained therein is unauthorized and prohibited. If you have received thi= +s in error, please contact the sender immediately and delete this e-mail an= +d any attachments. + +No responsibility is accepted for any virus or defect that might arise from= + opening this e-mail or attachments, whether or not it has been checked by = +anti-virus software. + +------_=_NextPart_001_01CC6C62.CEC3EF3C +Content-Type: text/html; charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable + +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> +<HTML> +<HEAD> +<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; charset=3Diso-8859-= +1"> +<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version 6.5.7654.12"> +<TITLE>Out of Office AutoReply: Was the response you got to your FOI reques= +t any good?</TITLE> +</HEAD> +<BODY> +<!-- Converted from text/plain format --> + +<P><FONT SIZE=3D2>I am out of the office and have limited access to my emai= +ls until Thursday 8th September. If you have an urgent query the plea= +se telephone me on 12345678.</FONT></P> + +<font face=3D"monospace"><br> +<br> +The information contained in this email and any attachments may be confiden= +tial and is provided solely for the use of the intended recipient(s). If yo= +u are not the intended recipient, you are hereby notified that any disclosu= +re, distribution, or use of this e-mail, its attachments or any information= + contained therein is unauthorized and prohibited. If you have received thi= +s in error, please contact the sender immediately and delete this e-mail an= +d any attachments.<br> +<br> +No responsibility is accepted for any virus or defect that might arise from= + opening this e-mail or attachments, whether or not it has been checked by = +anti-virus software.</font></BODY> +</HTML> +------_=_NextPart_001_01CC6C62.CEC3EF3C-- + diff --git a/spec/fixtures/files/track-response-generic-oof.email b/spec/fixtures/files/track-response-generic-oof.email new file mode 100644 index 000000000..bf1e3e8fe --- /dev/null +++ b/spec/fixtures/files/track-response-generic-oof.email @@ -0,0 +1,8 @@ +From: Someone <someone@example.com> +Subject: Out of Office: Notification blah blah blah +To: track@whatdotheyknow.com +Return-Path: <> +Content-Type: text/plain; charset=utf-8 + +I am out of the office till the 12th of February, hunting lions in Africa. + diff --git a/spec/fixtures/files/track-response-lotus-oof-1.email b/spec/fixtures/files/track-response-lotus-oof-1.email new file mode 100644 index 000000000..dbe63714d --- /dev/null +++ b/spec/fixtures/files/track-response-lotus-oof-1.email @@ -0,0 +1,58 @@ +Delivered-To: mysociety.robin@gmail.com +Received: by 10.216.187.197 with SMTP id y47cs137414wem; + Wed, 7 Sep 2011 14:02:45 -0700 (PDT) +Received: by 10.227.179.14 with SMTP id bo14mr1666492wbb.90.1315429363348; + Wed, 07 Sep 2011 14:02:43 -0700 (PDT) +Return-Path: <Arnos.Grove@example.net> +Received: from wildfire.ukcod.org.uk (wildfire.ukcod.org.uk [89.238.145.74]) + by mx.google.com with ESMTPS id 2si1547851wbx.79.2011.09.07.14.02.41 + (version=TLSv1/SSLv3 cipher=OTHER); + Wed, 07 Sep 2011 14:02:42 -0700 (PDT) +Received-SPF: neutral (google.com: 89.238.145.74 is neither permitted nor denied by best guess record for domain of Arnos.Grove@example.net) client-ip=89.238.145.74; +Authentication-Results: mx.google.com; spf=neutral (google.com: 89.238.145.74 is neither permitted nor denied by best guess record for domain of Arnos.Grove@example.net) smtp.mail=Arnos.Grove@example.net +Received: from foi by wildfire.ukcod.org.uk with local (Exim 4.69) + (envelope-from <Arnos.Grove@example.net>) + id 1R1PGV-0008Gu-GX + for team@whatdotheyknow.com; Wed, 07 Sep 2011 22:02:35 +0100 +Received: from eu1sys200aog108.obsmtp.com ([207.126.144.125]:54514) + by wildfire.ukcod.org.uk with smtp (Exim 4.69) + (envelope-from <Arnos.Grove@example.net>) + id 1R1PGS-0008Go-Ih + for track@whatdotheyknow.com; Wed, 07 Sep 2011 22:02:32 +0100 +Received: from DomG5P.tm-gnet.com ([80.195.120.125]) by eu1sys200aob108.postini.com ([207.126.147.11]) with SMTP + ID DSNKTmfb6CEGJQfujkX1ZzzGzMsn6uoI+AGs@postini.com; Wed, 07 Sep 2011 21:02:32 UTC +Received: from dc3-email-02.tm-gnet.com ([10.145.42.2]) + by DomG5P.tm-gnet.com (Lotus Domino Release 7.0.3) + with ESMTP id 2011090722024075-323511 ; + Wed, 7 Sep 2011 22:02:40 +0100 +Subject: Emma McKinney/MAIL/BIR/MG_REG is out of the office +Auto-Submitted: auto-generated +From: Arnos.Grove@example.net +To: track@whatdotheyknow.com +Message-ID: <OF82EB79DF.C2563724-ON80257904.00739633-80257904.00739633@TrinityMirror.com> +Date: Wed, 7 Sep 2011 22:02:30 +0100 +MIME-Version: 1.0 +X-MIMETrack: Serialize by Router on DC3-Email-02/GMH(Release 8.5.1FP4|July 25, 2010) at + 07/09/2011 22:02:31, + Itemize by SMTP Server on DomG5P/GMH(Release 7.0.3|September 26, 2007) at + 09/07/2011 22:02:40, + Serialize by Router on DomG5P/GMH(Release 7.0.3|September 26, 2007) at 09/07/2011 + 22:02:41, + Serialize complete at 09/07/2011 22:02:41 +Content-type: text/plain; charset=US-ASCII +List-Id: Admin Team for What Do They Know <team@whatdotheyknow.com> + + +I will be out of the office starting dd/mm/yyyy and will not return until +dd/mm/yyyy. + +If you need to contact anyone urgently while I'm out of the office call +aaaa bbb cccc or aaaa bbb dddd. + +******************** +IMPORTANT NOTICE This email (including any attachments) is meant only for the intended recipient. It may also contain confidential and privileged information. If you are not the intended recipient, any reliance on, use, disclosure, distribution or copying of this email or attachments is strictly prohibited. Please notify the sender immediately by email if you have received this message by mistake and delete the email and all attachments. + +Any views or opinions in this email are solely those of the author and do not necessarily represent those of Brickbat Industries PLC or its associated group companies (hereinafter referred to as "BI Group"). BI Group accept no liability for the content of this email, or for the consequences of any actions taken on the basis of the information provided, unless that information is subsequently confirmed in writing. Although every reasonable effort is made to keep its network free from viruses, BI Group accept no liability for any virus transmitted by this email or any attachments and the recipient should use up-to-date virus checking software. Email to or from this address may be subject to interception or monitoring for operational reasons or for lawful business practices. + +Brickbat PLC is the parent company of the Brickbat group of companies and is registered in England No 99999, with its address at Nine Made-up Lane, Arnos Grove. +******************** diff --git a/spec/fixtures/files/track-response-messageclass-oof.email b/spec/fixtures/files/track-response-messageclass-oof.email new file mode 100644 index 000000000..ce82b6df0 --- /dev/null +++ b/spec/fixtures/files/track-response-messageclass-oof.email @@ -0,0 +1,63 @@ +Delivered-To: mysociety.robin@gmail.com +Received: by 10.216.187.197 with SMTP id y47cs177522wem; + Thu, 8 Sep 2011 14:01:27 -0700 (PDT) +Received: by 10.216.220.168 with SMTP id o40mr1165141wep.75.1315515686762; + Thu, 08 Sep 2011 14:01:26 -0700 (PDT) +Return-Path: <MAILER-DAEMON@wildfire.ukcod.org.uk> +Received: from wildfire.ukcod.org.uk (wildfire.ukcod.org.uk [89.238.145.74]) + by mx.google.com with ESMTPS id k18si4719546wed.16.2011.09.08.14.01.25 + (version=TLSv1/SSLv3 cipher=OTHER); + Thu, 08 Sep 2011 14:01:25 -0700 (PDT) +Received-SPF: pass (google.com: best guess record for domain of MAILER-DAEMON@wildfire.ukcod.org.uk designates 89.238.145.74 as permitted sender) client-ip=89.238.145.74; +Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of MAILER-DAEMON@wildfire.ukcod.org.uk designates 89.238.145.74 as permitted sender) smtp.mail=MAILER-DAEMON@wildfire.ukcod.org.uk +Received: from foi by wildfire.ukcod.org.uk with local (Exim 4.69) + (envelope-from <MAILER-DAEMON@wildfire.ukcod.org.uk>) + id 1R1lio-0004zB-Fv + for team_delivery@whatdotheyknow.com; Thu, 08 Sep 2011 22:01:18 +0100 +Received: from mailproxy2.newsquest.co.uk ([93.174.8.201]:2528) + by wildfire.ukcod.org.uk with esmtp (Exim 4.69) + id 1R1lin-0004z2-Lk + for track@whatdotheyknow.com; Thu, 08 Sep 2011 22:01:17 +0100 +X-IronPort-AV: E=Sophos;i="4.68,352,1312153200"; + d="scan'208";a="450582625" +Content-Type: multipart/mixed; boundary="===============1667734580==" +MIME-Version: 1.0 +Received: from sx-mailtraq.se.ad.newsquest.co.uk (sx-mailtraq.se.ad.newsquest.co.uk [10.50.6.12]) + by nqsussex.co.uk with ESMTP (Mailtraq/2.12.0.2278) id NQSSF0865193 + for track@whatdotheyknow.com; Thu, 08 Sep 2011 22:01:04 +0100 +From: "bjarne.stroustrup" <bjarne.stroustrup@example.co.uk> +To: track@whatdotheyknow.com +Date: Thu, 08 Sep 2011 22:01:01 +0100 +Message-ID: <THRGF086ADB9@example.co.uk> +Subject: Automatic Response +X-Hops: 1 +X-POST-MessageClass: 9; Autoresponder + +--===============1667734580== +MIME-Version: 1.0 +Content-Type: text/plain; charset="" + +I am out of the office until Tuesday, January 20. If your email is +urgent please resend it to news@example.co.uk. +Thanks very much +Boris + +--===============1667734580== +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline + +This email has been scanned for viruses and other threats using Newsquest's= + Ironport email filters. + +This document is private and confidential. +All property, copyright and other rights in it and its contents belong to +ewsquest Media Group Limited. +It must not be read, copied, disclosed or otherwise used without Newsquest= +=E2=80=99s authorisation. Newsquest may exercise its legal rights and remed= +ies in the event of any such unauthorised use. + + +--===============1667734580==-- + 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 856476c3f..eae0b516b 100644 --- a/spec/script/handle-mail-replies_spec.rb +++ b/spec/script/handle-mail-replies_spec.rb @@ -29,5 +29,30 @@ describe "When filtering" do r.status.should == 1 r.out.should == "FailedUser@example.com\n" end + + it "should detect a generic out-of-office" do + r = mail_reply_test("track-response-generic-oof.email") + r.status.should == 2 + end + + it "should detect an Exchange-style out-of-office" do + r = mail_reply_test("track-response-exchange-oof-1.email") + r.status.should == 2 + end + + it "should detect a Lotus Domino-style out-of-office" 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 + + it "should detect an out-of-office that has an X-POST-MessageClass header" do + r = mail_reply_test("track-response-messageclass-oof.email") + r.status.should == 2 + end end |