Characters mysteriously disappearing from Magento Email Templates

Today my colleagues and I faced a very strange issue.

Adding the most simple of inline CSS styling to a Magento email template resulted in the email breaking further down the page.

By breaking, I mean that parts of the html code would be displayed as plain text in the email, or sections of text would disappear when viewed in Microsoft Outlook.

One particular section we noticed was that the end was being cut off the “Billing Information:” heading. After adding a 7 character hex color decalaration, the title became “Billing Infor”. 7 characters less than before.

After a bit of research we discovered that Magento tries to ‘intelligenlty’ add line breaks for text that is over 80 characters.

However, the function does not seem to discount html tags first, meaning that a particularly long tag, is sometimes split into two and therefore displays incorrectly.

Adding several of our own line breaks fixed the issue, but hopefully the team behind Magento will fix this bug to ensure others don’t get caught out by the same issue.

Leave a Reply