Fixes #3870 - Text rendering does not work for e-mails (no new lines)
This commit is contained in:
parent
a8aea71a85
commit
b757f8e2c5
3 changed files with 22 additions and 18 deletions
|
@ -606,6 +606,20 @@ process unprocessable_mails (tmp/unprocessable_mail/*.eml) again
|
||||||
if mail.html_part&.body.present?
|
if mail.html_part&.body.present?
|
||||||
content_type = mail.html_part.mime_type || 'text/plain'
|
content_type = mail.html_part.mime_type || 'text/plain'
|
||||||
body = body_text(mail.html_part, strict_html: true)
|
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?
|
elsif mail.text_part.present?
|
||||||
content_type = 'text/plain'
|
content_type = 'text/plain'
|
||||||
|
|
||||||
|
@ -614,9 +628,6 @@ process unprocessable_mails (tmp/unprocessable_mail/*.eml) again
|
||||||
.reduce('') do |memo, part|
|
.reduce('') do |memo, part|
|
||||||
if part.mime_type == 'text/plain' && !part.attachment?
|
if part.mime_type == 'text/plain' && !part.attachment?
|
||||||
memo += body_text(part, strict_html: false)
|
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
|
end
|
||||||
|
|
||||||
memo
|
memo
|
||||||
|
|
|
@ -29,6 +29,9 @@ Content-Type: text/plain;
|
||||||
|
|
||||||
Text
|
Text
|
||||||
|
|
||||||
|
new line
|
||||||
|
|
||||||
|
Test 123
|
||||||
|
|
||||||
--Apple-Mail=_57B3D7B4-58AD-4E7A-9A4A-5053521E2862
|
--Apple-Mail=_57B3D7B4-58AD-4E7A-9A4A-5053521E2862
|
||||||
Content-Disposition: inline;
|
Content-Disposition: inline;
|
||||||
|
@ -6646,5 +6649,8 @@ Content-Type: text/plain;
|
||||||
|
|
||||||
Text
|
Text
|
||||||
|
|
||||||
|
Text line
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
--Apple-Mail=_57B3D7B4-58AD-4E7A-9A4A-5053521E2862--
|
--Apple-Mail=_57B3D7B4-58AD-4E7A-9A4A-5053521E2862--
|
||||||
|
|
|
@ -4,21 +4,8 @@ from_email: top@secret.tld
|
||||||
from_display_name: Mr. Top Secret
|
from_display_name: Mr. Top Secret
|
||||||
to: zammad@XXXXXXXXX.de
|
to: zammad@XXXXXXXXX.de
|
||||||
subject: Text - Bild - Text - PDF - Text - Bild - Text
|
subject: Text - Bild - Text - PDF - Text - Bild - Text
|
||||||
body: |+
|
body: Text<br><br>new line<br><br>Test 123<br><img src='cid:inline_attachment_placeholder_1'><br><br>Text<br><br><br><br>Text<br><br><img
|
||||||
Text
|
src='cid:inline_attachment_placeholder_2'><br><br>Text<br><br>Text line<br><br>end<br>
|
||||||
|
|
||||||
<img src='cid:inline_attachment_placeholder_1'>
|
|
||||||
|
|
||||||
Text
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Text
|
|
||||||
|
|
||||||
<img src='cid:inline_attachment_placeholder_2'>
|
|
||||||
|
|
||||||
Text
|
|
||||||
|
|
||||||
content_type: text/html
|
content_type: text/html
|
||||||
attachments:
|
attachments:
|
||||||
- !ruby/hash:ActiveSupport::HashWithIndifferentAccess
|
- !ruby/hash:ActiveSupport::HashWithIndifferentAccess
|
||||||
|
|
Loading…
Reference in a new issue