diff options
author | Matthew Landauer <matthew@openaustralia.org> | 2013-02-01 17:39:05 +1100 |
---|---|---|
committer | Matthew Landauer <matthew@openaustralia.org> | 2013-02-01 17:39:05 +1100 |
commit | 8ef10e453fb0c87c3c58ce6eefdd54c1928a6590 (patch) | |
tree | 91d98cb3fee88282f39ccdc2b28542ea40576617 | |
parent | d05f4b605f21501e54d3576eae6f5f1af190ba18 (diff) |
Move over to rails 3 mail api because there appear to be problems with sending attachments
-rw-r--r-- | app/models/request_mailer.rb | 20 | ||||
-rw-r--r-- | spec/models/request_mailer_spec.rb | 2 |
2 files changed, 11 insertions, 11 deletions
diff --git a/app/models/request_mailer.rb b/app/models/request_mailer.rb index f07e3c3d8..116a9fe81 100644 --- a/app/models/request_mailer.rb +++ b/app/models/request_mailer.rb @@ -44,17 +44,17 @@ class RequestMailer < ApplicationMailer # Incoming message arrived for a request, but new responses have been stopped. def stopped_responses(info_request, email, raw_email_data) - @from = contact_from_name_and_email - headers 'Return-Path' => blackhole_email, 'Reply-To' => @from, # we don't care about bounces, likely from spammers + headers 'Return-Path' => blackhole_email, # we don't care about bounces, likely from spammers 'Auto-Submitted' => 'auto-replied' # http://tools.ietf.org/html/rfc3834 - @recipients = email.from_addrs[0].to_s - @subject = _("Your response to an FOI request was not delivered") - attachment :content_type => 'message/rfc822', :body => raw_email_data, - :filename => "original.eml", :transfer_encoding => '7bit', :content_disposition => 'inline' - @body = { - :info_request => info_request, - :contact_email => Configuration::contact_email - } + + attachments.inline["original.eml"] = raw_email_data + + @info_request = info_request + @contact_email = Configuration::contact_email + + mail(:from => contact_from_name_and_email, :to => email.from_addrs[0].to_s, + :reply_to => contact_from_name_and_email, + :subject => _("Your response to an FOI request was not delivered")) end # An FOI response is outside the scope of the system, and needs admin attention diff --git a/spec/models/request_mailer_spec.rb b/spec/models/request_mailer_spec.rb index 5edc8edb6..f7eaa58f8 100644 --- a/spec/models/request_mailer_spec.rb +++ b/spec/models/request_mailer_spec.rb @@ -98,7 +98,7 @@ describe RequestMailer, " when receiving incoming mail" do mail.multipart?.should == true mail.parts.size.should == 2 message_part = mail.parts[0].to_s - bounced_mail = MailHandler.mail_from_raw_email(mail.parts[1].body) + bounced_mail = MailHandler.mail_from_raw_email(mail.parts[1].body.to_s) bounced_mail.to.should == [ ir.incoming_email ] bounced_mail.from.should == [ 'geraldinequango@localhost' ] bounced_mail.body.include?("That's so totally a rubbish question").should be_true |