diff options
Diffstat (limited to 'app/models/request_mailer.rb')
-rw-r--r-- | app/models/request_mailer.rb | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/app/models/request_mailer.rb b/app/models/request_mailer.rb index 493d6961c..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 @@ -76,15 +76,17 @@ class RequestMailer < ApplicationMailer def new_response(info_request, incoming_message) # Don't use login link here, just send actual URL. This is # because people tend to forward these emails amongst themselves. - url = main_url(incoming_message_url(incoming_message)) + @url = main_url(incoming_message_url(incoming_message)) + @incoming_message, @info_request = incoming_message, info_request - @from = contact_from_name_and_email - headers 'Return-Path' => blackhole_email, 'Reply-To' => @from, # not much we can do if the user's email is broken + headers 'Return-Path' => blackhole_email, 'Auto-Submitted' => 'auto-generated', # http://tools.ietf.org/html/rfc3834 'X-Auto-Response-Suppress' => 'OOF' - @recipients = info_request.user.name_and_email - @subject = _("New response to your FOI request - ") + info_request.title - @body = { :incoming_message => incoming_message, :info_request => info_request, :url => url } + mail(:from => contact_from_name_and_email, :to => info_request.user.name_and_email, + :subject => _("New response to your FOI request - ") + info_request.title, + :charset => "UTF-8", + # not much we can do if the user's email is broken + :reply_to => contact_from_name_and_email) end # Tell the requester that the public body is late in replying |