--- app/models/mail_handler.rb 2014-03-29 17:56:13.000000000 +0100 +++ app/models/mail_handler.new.rb 2014-06-16 08:27:02.067372711 +0200 @@ -275,6 +275,18 @@ :content_type => attachment.mime_type) end end + if (parts = email.all_parts.select {|p| p.mime_type == 'text/html'}).present? + html_parts = parts.map do |p| + body_charset = p.charset.respond_to?(:force_encoding) ? + Mail::RubyVer.pick_encoding(p.charset).to_s : p.charset + Redmine::CodesetUtil.to_utf8(p.body.decoded, body_charset) + end.join("") + obj.attachments << Attachment.create(:container => obj, + :file => html_parts, + :filename => 'HTML version', + :author => user, + :content_type => 'text/html') + end end # Returns false if the +attachment+ of the incoming email should be ignored