Why are these classes in form of class="m_05989..."?

67 Views Asked by At

I am trying to create an email newsletter so I got inspired by several other companies and their newsletters.

When I got into the code, almost every opening tag has it´s class in the form of class="m_NUMBERSdescription".

<td class="m_994698102857902905m_6256050063364427208main-td m_994698102857902905gmail_msg" 
style="border:1px solid #dddddd;border-radius:2px>

It is not clear to me why there are these classes when the style is already defined via inline CSS, and how were they created.

Thank you for help!

1

There are 1 best solutions below

0
On BEST ANSWER

Those are wrappers added by Gmail; they aren't in the original message. If you look at the message in Gmail using "view source" (or "inspect"), you see classes like those. But if you use the "show original" feature,* you'll see different classes. In this case, those are probably just "main-td" or something similar.

For example, in one email in my inbox, I see this when looking at "view source":

<div class="m_-7612240734780902511pcont-text" style="margin-right:140px">...</div>

The same element in the original source is actually:

<div class="pcont-text" style="margin-right:140px;">...</div>

Why does it do this? You'd have to ask Google to be sure, but we can say pretty confidently that it's to prevent styling in emails from overriding the Gmail UI styling. You wouldn't want, for example, an email to restyle your inbox to look like a bank's login page. That would provide a vector for phishing, and phishing == bad.


To access the "show original" feature, use the dropdown at the upper right corner of the message display area:

Dropdown box with "show original" highlighted