Why does GMail break the inline (CSS) styles for mini-markup / HTML email using quotation marks?

I had an email that was truncated by GMail (about 120 KB in size - according to http://www.adestra.com/avoid-gmail-clipping-emails/ , GMail starts clipping messages at 102 KB)

GMail clipping emails

To reduce the size of the email, I decided to try django-htmlmin and simple ol ' re.sub(r'\n\s*(\S)', r'\1', email_html_content)(changing the markup using regular expression is another discussion for one day). Both of these technologies reduced email size by 30% +, but both solutions violated GMail's rendering. When checking out a broken design using Dev Tools, it seems like some elements don't get any inline styles, apparently randomly.

Element in GMail without any inline styles

However, when I clicked the Show Original button to view the raw message, I see inline styles for the item.

Inline styles visible in the raw email

, quote-printable. , 1 , (= ) , . (= ) , , , , , ( , - , , , 78 (?) ).

, . , ( =), , , =0D. , , , . :

random paragraphs delimited by <code> = 0D </code> character

, , , . , re.sub(r'\n\s*(\S)', r'\n\1', email_body) re.sub(r'\n\s*(\S)', r'\1', email_body) - .. ( ) , . , =0D . , .

With each tag on a separate line

, , HTML ? ?

+4
3

, - html.

, , html ( gmail) html.

, . , , html- . .

, , html- , .

html-minifier ( gulp-htmlmin, "html- minifier" ), { maxLineLength: 996 } .

:)

+1
0

, , .

.

re.sub(r'\n\s*(\S)', r'\1', email_html_content), , , (= 0D). . re.sub(r'\n\s*(\S)', r'\n\1', email_body) . , .

, , :

re.sub(r'\r\n\s*(\S)', r'\1', email_html_content)

css.

, :

re.sub(r'\s*\r\n\s*', r'', email_html_content)

This works as follows: find any number of spaces, a pair of carriage return lines and any number of spaces and delete them, instead of finding a pair of carriage return channels, any number of spaces and one non-white space char and replace it with char.

0
source

All Articles