diff --git a/app/models/message_gateway.rb b/app/models/message_gateway.rb index ed46fa1e..4106c2ae 100644 --- a/app/models/message_gateway.rb +++ b/app/models/message_gateway.rb @@ -34,8 +34,8 @@ class MessageGateway < ActionMailer::Base attachment = todo.attachments.build # create temp file - tmp = Tempfile.new(['attachment', '.eml'], universal_newline: true) - tmp.write email.raw_source + tmp = Tempfile.new(['attachment', '.eml'], {universal_newline: true}) + tmp.write email.raw_source.gsub(/\r/, "") # add temp file to attachment. paperclip will copy the file to the right location Rails.logger.info "Saved received email to #{tmp.path}"