Over the last month, a small number of users have reported garbled characters appearing in their Gmail mail merge campaigns with GMass. In most cases they reported characters like “Â” appearing randomly throughout the text of the email that is sent after clicking the GMass button. The issue tended to surface in emails containing non-English characters.
I’ve been wanting to get to the bottom of the issue for a while, but I couldn’t because I couldn’t actually reproduce the issue myself…until tonight.
Earlier today, I conducted a screen share session with a user that had experienced the bug and she was able to walk me through the steps to reproduce the bug. After capturing some data, and spending all evening investigating, I finally figured out the cause and solved the problem.
The problem only surfaced if the To field of a Gmail Draft contained an email address that contained a foreign character. The mere presence of a foreign character in a single email address would cause all individual emails sent to all recipients of the campaign to receive a message with garbled characters. Even if a test message was sent to just one test address containing non-foreign characters using the “Send Test Email” feature, that test would also contain garbled characters, because the To field contained an address with foreign characters when the “Send Test Email” button was clicked.
For the technical types, the issue was related to the way Gmail encodes email messages in certain situations. While the standard encoding for both the HTML and Plain Text MIME parts of a Gmail Draft are encoded as quoted-printable, if an email address in the To field contains a foreign character, then the encoding of both MIME parts becomes “8bit” instead of “quoted-printable”.
This single anomaly threw off the GMass code that disassembles a message to add open and click tracking and then reassembles it for sending. The reassemby wasn’t able to output all characters in the necessary “8bit” encoding format.
The fix was to modify how the final message is outputted so that “8bit” encoding is handled properly. This required writing to a memory stream instead of a string. I’m happy to share more details with any interested parties — just get in touch.
Ajay is the founder of GMass and has been developing email sending software for 20 years.