email.patch

Joe Darkless, 2014-06-16 08:54

Download (969 Bytes)

View differences:

app/models/mail_handler.new.rb 2014-06-16 08:27:02.067372711 +0200
275 275
                          :content_type => attachment.mime_type)
276 276
      end
277 277
    end
278
    if (parts = email.all_parts.select {|p| p.mime_type == 'text/html'}).present?
279
      html_parts = parts.map do |p|
280
        body_charset = p.charset.respond_to?(:force_encoding) ?
281
                        Mail::RubyVer.pick_encoding(p.charset).to_s : p.charset
282
        Redmine::CodesetUtil.to_utf8(p.body.decoded, body_charset)
283
      end.join("</hr>")
284
      obj.attachments << Attachment.create(:container => obj,
285
                          :file => html_parts,
286
                          :filename => 'HTML version',
287
                          :author => user,
288
                          :content_type => 'text/html')
289
    end
278 290
  end
279 291

  
280 292
  # Returns false if the +attachment+ of the incoming email should be ignored