I need to remove CSS of a string from the bodies of E-Mails, such that I get only the real message someone would read from that mail.
Many e-mails contain lots of HTML, which I already was able to strip using striptags. However, the CSS remains. As an example mailbody:
table.footer-table { width: 100%; font-size: inherit; line-height: 18px; text-align: center; }
Dear Sir,
Hello. Kind regards, John
As this is an example, in reality there are lots more CSS classes defined above the actual message.
I do not know what classes etc. will be in such mail (e.g. if it starts with table or whatever).
Question: How can the CSS be efficiently removed from the string?
I have not found a library yet which is able to do that.
$("table").removeAttr("style")