Reputation: 1031
I am using the Sendgrid node library to send transactional emails. Everything was working fine until today I received a complaint that some people with @live.com or @optonline.net emails were receiving emails that are just a wall of Chinese and some other characters. The emails send fine to every other email, and it's not everyone with those emails either, only a few.
No errors show up in the console, and looking through the Sendgrid dashboard shows that there were no issues sending the emails either.
This is an example of what the email looks like:
As you can see the title comes out fine, but the body comes out weird.
Here is what it is supposed to look like:
Any idea what is going on here? Or how to fix this? It's not a major issue as it's only a subset of people experiencing this issue, however, it's still quite frustrating.
Upvotes: 3
Views: 1600
Reputation: 1031
The solution was actually arrived at by my coworker Brian.
So SendGrid sends out emails with the ISO 8859-1 encoding, which if certain email clients mismatch the encoding with the body of the email, they will display the email weirdly like in the screenshot as posted.
It took us a while to figure out what was tripping up the emails, and eventually realized there was something in our templates that either had a different encoding or tripped it up, and when we tested creating a new template from scratch, it worked fine.
We used the template builder in SendGrid to recreate our templates that we had been using, and exported that to code, replacing our older templates. The emails now showed up properly.
So the issue was a content encoding mismatch and making sure there was nothing in the template source that had a different encoding was the solution.
Upvotes: 2