Remove HTML Line Breaks and Whitespace before Sending

Remove HTML Line Breaks and Whitespace before Sending

The issue: Gmail clips emails over 102kb (https://mailchimp.com/help/gmail-is-clipping-my-email/).

 

Our solution:

Before we push HTML into Marketo through the API (https://developers.marketo.com/rest-api/assets/emails/#update_editable_section), we remove line breaks and whitespace in the HTML.

 

For example:

 

<html>
    <body>
        <h1>Hello World</h1>
    </body>
</html>

 

 

Is converted to:

 

<html> <body> <h1>Hello World</h1> </body></html>

 

 

This reduces the file size by ~50 kb (from 150kb to 98 kb). If someone on our team edits an email in Marketo, the text editor automatically ads the line breaks and spacing into our HTML. It would be great to have an option to remove the HTML line breaks (\n), HTML white space, and HTML tabs (\t) inside Marketo during email sends.