I have both text and html parts for my emails. Users are reporting 'garbage characters' in some cases where the email is include values from the db. It seems to be an issue when unicode characters are involved. I created trivial template that just echos back the value for both the text and html parts (<%= @body_text %>
) and tested it out with a sample string:
a permanent feature ë
When I see this string in gmail it looks like:
a permanent feature ������
Inspecting the header I see this on the mail:
Content-Type: multipart/alternative; charset=UTF-8 Content-Transfer-Encoding: 7bit
and then the text part:
Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: base64
and the html part:
Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
ruby 1.9.2, rails 3.2.6
Root cause was identified as premailer-rails3 gem == 1.2.0. Migrating to actionmailer_inline_css gem resolved.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With