5
votes

Setup:

Ruby 1.9.2
Rails 3.2.2

I'm having some trouble with the encoding of my emails.

Note: I'm not that familiar with encoding and stuff like that.

When sending an email with ActionMailer, something weird is going on with the html in the email.

All equal(=) signs are getting changed to =3D. Example:

<table border=3D"0" cellpadding=3D"0" cellspacing=3D"0" width=3D"=440">
  <tbody>
    <tr>
      <td height=3D"10">   </td>
    </tr>
  </tbody>
</table>

Special characters looks like this: ä -> ä.

It looks great in local development, but when using SendGrid on production server, special characters don't work.

I'm sure this is because my lack of understanding.

Here's the mail Header:

Mime-Version: 1.0
Content-Type: text/html;
 charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-SMTPAPI: {"filters": {}}

Does it have anything to do with Content-Transfer-Encoding? Or should it be like that?

Maybe it's a problem with SendGrid and not my setup?

An employee at SendGrid told me this: you need to make sure your equals signs are URI-encoded, what does that mean? Thanks in advance!

2
After some research maybe the mail should have equal (and other characters) changed to =3D(since it's quoted-printable) , but I can't figure out why characters like åäö don't work.Tim Brunsmo

2 Answers

1
votes

It was not a problem on my side, it was SendGrid. Mails sent through SendGrid with characters like "åäö" does not work in mail clients like yahoo/outlook/MacMail.

After a few hours of support with an employee at SendGrid the problem still persists. They say that the problem is in my setup. I've now switched to mailgun with exactly the same setup and it works great.

0
votes

I solved my problem by adding default 'Content-Transfer-Encoding' => '7bit' to my ActionMailer.

Have a look at the API docs.