diff options
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 => { |