From f07444d80961fcd3e7bb9555f5ed4a4e0b65b5db Mon Sep 17 00:00:00 2001 From: Henare Degan Date: Wed, 27 Feb 2013 14:17:16 +1100 Subject: Remove Tmail and use the Mail gem under Ruby 1.8.7 as well --- app/controllers/request_controller.rb | 29 ++--------------------------- 1 file changed, 2 insertions(+), 27 deletions(-) (limited to 'app/controllers/request_controller.rb') diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb index c8da8e845..680833ae4 100644 --- a/app/controllers/request_controller.rb +++ b/app/controllers/request_controller.rb @@ -853,33 +853,8 @@ class RequestController < ApplicationController return end - # There is duplication of the email creation code in api_controller.rb - # TODO: Remove duplication - if MailHandler.backend == "TMail" - # Directly construct Tmail object using attachment_hashes - mail = TMail::Mail.new - mail.from = @user.name_and_email - mail.to = @info_request.incoming_name_and_email - - b = TMail::Mail.new - b.body = body - b.set_content_type("text/plain") - b['Content-Disposition'] = "inline" - mail.parts << b - - if !file_name.nil? && !file_content.nil? - content_type = AlaveteliFileTypes.filename_to_mimetype(file_name) || 'application/octet-stream' - - attachment = TMail::Mail.new - attachment.body = Base64.encode64(file_content) - attachment.transfer_encoding = "base64" - attachment['Content-Type'] = "#{content_type}; name=\"#{file_name}\"" - attachment['Content-Disposition'] = "attachment; filename=#{file_name}" - mail.parts << attachment - end - else - mail = RequestMailer.fake_response(@info_request, @user, body, file_name, file_content) - end + mail = RequestMailer.fake_response(@info_request, @user, body, file_name, file_content) + @info_request.receive(mail, mail.encoded, true) flash[:notice] = _("Thank you for responding to this FOI request! Your response has been published below, and a link to your response has been emailed to ") + CGI.escapeHTML(@info_request.user.name) + "." redirect_to request_url(@info_request) -- cgit v1.2.3