diff options
-rw-r--r-- | app/models/request_mailer.rb | 4 | ||||
-rw-r--r-- | spec/models/request_mailer_spec.rb | 7 |
2 files changed, 9 insertions, 2 deletions
diff --git a/app/models/request_mailer.rb b/app/models/request_mailer.rb index 16bdba911..7ed571b18 100644 --- a/app/models/request_mailer.rb +++ b/app/models/request_mailer.rb @@ -4,7 +4,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: request_mailer.rb,v 1.75 2009-05-21 01:18:45 francis Exp $ +# $Id: request_mailer.rb,v 1.76 2009-06-15 16:01:49 francis Exp $ class RequestMailer < ApplicationMailer @@ -96,7 +96,7 @@ class RequestMailer < ApplicationMailer headers 'Return-Path' => blackhole_email, 'Reply-To' => @from # we don't care about bounces, likely from spammers @recipients = email.from_addrs[0].to_s @subject = "Your response to an FOI request was not delivered" - attachment :content_type => 'message/rfc822', :body => email.body + attachment :content_type => 'message/rfc822', :body => email.to_s @body = { :info_request => info_request, :contact_email => MySociety::Config.get("CONTACT_EMAIL", 'contact@localhost') diff --git a/spec/models/request_mailer_spec.rb b/spec/models/request_mailer_spec.rb index bd91fb778..5d901dfed 100644 --- a/spec/models/request_mailer_spec.rb +++ b/spec/models/request_mailer_spec.rb @@ -50,6 +50,13 @@ describe RequestMailer, " when receiving incoming mail" do deliveries.size.should == 1 mail = deliveries[0] mail.to.should == [ 'geraldinequango@localhost' ] + # check attached bounce is good copy of incoming-request-plain.email + mail.multipart?.should == true + mail.parts.size.should == 2 + bounced_mail = TMail::Mail.parse(mail.parts[1].body) + bounced_mail.to.should == [ ir.incoming_email ] + bounced_mail.from.should == [ 'geraldinequango@localhost' ] + bounced_mail.body.include?("That's so totally a rubbish question") deliveries.clear end |