FIX: Prevent email encoding issues when attachments are added (PR #10770)

When attachments are added to an outgoing email we have to do some faffing around with the Mail gem parts (refer to https://github.com/discourse/discourse/blob/e5b7db38e3293297fb54d620eb699a8d0857c46b/lib/email/sender.rb#L301-L318). However this causes the charset of the html and text parts to revert to US-ASCII which causes encoding issues. For example this:

It’s a fine day.

Turns into:

It’s a fine day.

This PR changes the way we add the parts back to the email to better reflect the example in https://www.rubydoc.info/github/mikel/mail/Mail/Message#part-instance_method where we use the decoded body string and provide the content type and charset as parameters so we are explicit about what we want.

GitHub

Very nice!

Awesome!