FIX: Correct corrupt encoding in emails containing attachments

This commit is contained in:
Martin Brennan
2020-09-29 14:10:57 +10:00
committed by GitHub
parent ffdcac9dfc
commit a8ed0b4612
2 changed files with 20 additions and 3 deletions

View File

@ -332,8 +332,11 @@ module Email
content = Mail::Part.new do
content_type "multipart/alternative"
part html_part
part text_part
# we have to re-specify the charset and give the part the decoded body
# here otherwise the parts will get encoded with US-ASCII which makes
# a bunch of characters not render correctly in the email
part content_type: "text/html; charset=utf-8", body: html_part.body.decoded
part content_type: "text/plain; charset=utf-8", body: text_part.body.decoded
end
@message.parts.unshift(content)