|
@@ -607,6 +607,20 @@ process unprocessable_mails (tmp/unprocessable_mail/*.eml) again
|
|
|
if mail.html_part&.body.present?
|
|
|
content_type = mail.html_part.mime_type || 'text/plain'
|
|
|
body = body_text(mail.html_part, strict_html: true)
|
|
|
+ elsif mail.text_part.present? && mail.all_parts.any? { |elem| elem.inline? && elem.content_type&.start_with?('image') }
|
|
|
+ content_type = 'text/html'
|
|
|
+
|
|
|
+ body = mail
|
|
|
+ .all_parts
|
|
|
+ .reduce('') do |memo, part|
|
|
|
+ if part.mime_type == 'text/plain' && !part.attachment?
|
|
|
+ memo += body_text(part, strict_html: false).text2html
|
|
|
+ elsif part.inline? && part.content_type&.start_with?('image')
|
|
|
+ memo += "<img src=\'cid:#{part.cid}\'>"
|
|
|
+ end
|
|
|
+
|
|
|
+ memo
|
|
|
+ end
|
|
|
elsif mail.text_part.present?
|
|
|
content_type = 'text/plain'
|
|
|
|
|
@@ -615,9 +629,6 @@ process unprocessable_mails (tmp/unprocessable_mail/*.eml) again
|
|
|
.reduce('') do |memo, part|
|
|
|
if part.mime_type == 'text/plain' && !part.attachment?
|
|
|
memo += body_text(part, strict_html: false)
|
|
|
- elsif part.inline? && part.content_type&.start_with?('image')
|
|
|
- content_type = 'text/html'
|
|
|
- memo += "<img src=\'cid:#{part.cid}\'>"
|
|
|
end
|
|
|
|
|
|
memo
|