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/api_controller.rb | 25 +++---------------------- 1 file changed, 3 insertions(+), 22 deletions(-) (limited to 'app/controllers/api_controller.rb') diff --git a/app/controllers/api_controller.rb b/app/controllers/api_controller.rb index 61b68a2db..57eca965e 100644 --- a/app/controllers/api_controller.rb +++ b/app/controllers/api_controller.rb @@ -148,28 +148,9 @@ class ApiController < ApplicationController :filename => filename ) end - if MailHandler.backend == "TMail" - # Directly construct Tmail object using attachment_hashes - mail = TMail::Mail.new - mail.body = body - blackhole_email = Configuration::blackhole_prefix+"@"+Configuration::incoming_email_domain - mail.from = blackhole_email - mail.to = request.incoming_name_and_email - mail.date = sent_at.dup.localtime - b = TMail::Mail.new - b.body = body - mail.parts << b - attachment_hashes.each do |attachment_hash| - attachment = TMail::Mail.new - attachment.body = Base64.encode64(attachment_hash[:body]) - attachment.transfer_encoding = "Base64" - attachment.set_content_type(attachment_hash[:content_type]) - attachment['Content-Disposition'] = "attachment; filename=#{attachment_hash[:filename]}" - mail.parts << attachment - end - else - mail = RequestMailer.external_response(request, body, sent_at, attachment_hashes) - end + + mail = RequestMailer.external_response(request, body, sent_at, attachment_hashes) + request.receive(mail, mail.encoded, true) end render :json => { -- cgit v1.2.3