diff options
author | Henare Degan <henare.degan@gmail.com> | 2013-02-27 14:17:16 +1100 |
---|---|---|
committer | Henare Degan <henare.degan@gmail.com> | 2013-02-27 14:17:16 +1100 |
commit | f07444d80961fcd3e7bb9555f5ed4a4e0b65b5db (patch) | |
tree | 518417e41c3758d2e0e50f537cb617694e94f3a4 /app/controllers/api_controller.rb | |
parent | 65247a15ab8d876d7fd60ccf6ef91e2487c166e5 (diff) |
Remove Tmail and use the Mail gem under Ruby 1.8.7 as well
Diffstat (limited to 'app/controllers/api_controller.rb')
-rw-r--r-- | app/controllers/api_controller.rb | 25 |
1 files changed, 3 insertions, 22 deletions
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 => { |