Gmail wraps certain HTML elements in a class called im
HtmlGmailHtml Problem Overview
I have been testing out an HTML e-mail process I've created recently. But as of lately, when I open the e-mail in Gmail, I'm noticing that certain elements are wrapped in a class that I know I didn't put in the original HTML layout. In fact I just triple checked! When viewing the HTML email in Gmail, random sections of my form are being wrapped with...
<div class="im">
....
</div>
As a result, some text turns purple, while other text does not. Why does this happen?
Thanks
Html Solutions
Solution 1 - Html
Gmail seems to think that you are quoting other emails in a conversation and so is wrapping div.im
around the sections of your code that it thinks are previous bits in a conversation.
This might happen if your code has a TABLE with more than one TR. To get around this, rather than several TRs in one TABLE, use several TABLEs with one TR in each.
This might also happen if you have multiple subject lines that are the same, causing Gmail to think this is a conversation. You can fix this by making each subject line unique.
Solution 2 - Html
Separate style files do not work for emails. What you can do though is add style for this class in the html as follows:
<head>
<style type="text/css">
.im {
color: #000000 !important;
}
</style>
</head>
This should give style to the class .im in case its found
Solution 3 - Html
I also experienced this problem when using a paragraph with single line breaks in it like this:
<p>
line 1<br>
line 2<br>
line 3
</p>
I was able to correct the problem from happening in Gmail from removing all the blank space from that specific part of HTML and bringing that entire paragraph and all it's contents back flush against the left edge of the screen. Sure it looks a little messy and you lose your proper indenting, but I think this helps Gmail not accidentally think you're quoting something inline.
Solution 4 - Html
I had similar problems. I was sending emails from an application using templates. So, when I sent multiple emails to same address, lines that are exactly same in all of them got purple. Gmail added this tag automatically:
<div class="im">
.........
</div>
I do not know that for a fact, seemed to me Gmail wraps the common texts in a conversation with the this tag. Similar discussion here.
Solution 5 - Html
I have this issue too. And I just added a five-bit random char
to every line end and set the color like the background. Then the issue got fixed.
It's not a good way, but if no another way, maybe you can try it.
Solution 6 - Html
You ignore style of im class on this way
<b style="color:black;">Some text</b>
Some text does not have purple color
Solution 7 - Html
You can use <br>
tag in email html if it has style like: <br style="box-sizing:border-box">
Solution 8 - Html
Inside my main table I created, as the last child add:
<div style="display:none;">1</div>
and the number 1
increments each time. I am generating the content with js using a template string
`<div style="display:none;">${new Date().toString()}</div>`
You will also need to add style="color:#000;"
to the parent.
This will prevent the entire email as showing as quoted, and hence not color the text with the .im
class
Solution 9 - Html
If you replay to an email Gmail automatically puts your content in a <div class="im">
, that's why text colors turn purple.
Just try to compose a new email.
Solution 10 - Html
So I had encountered this problem when designing a mailing system for a web application of mine. The solutions given here were a bit time-consuming to implement for me as the mail content was huge and in lots of places span tags were getting added. It's when I come across this document. It turns out Gmail adds the .im class span tags when Gmail client receives two or more emails with the same subject line. All emails are grouped in a conversation group based on the subject line. Gmail detects some of the parts of the second (third, fourth..) email as quoted from the previous email. I simply deleted the previous emails and the problem was solved for me as Gmail didn't group the mails together. The article which helped me =>
https://litmus.com/community/discussions/5189-gmail-changes-color-of-text-im-class
This solution worked for me as the intended behavior of my application was not to share multiple emails at once. Hope so this answer finds helpful
Solution 11 - Html
Gmail display feature added a span with .im class to some text. To solve this in the styles tag defined in the head of the email I added the following styles:
<head>
<style>
.im {
color: inherit !important;
}
div > span.im {
color: inherit !important;
}
p > span.im {
color: inherit !important;
}</style></head>
Solution 12 - Html
Please use styles on your page:
div.adm { display: none !important;}
div.h5 { display: block !important;}