Anyone know of a PHP method, code snippet or project that I can use or start with to take a HTML input and remove the <style> tag but apply all the styles to each element they were intended for?
Example Input:
<html>
<head>
<style>
body {
font-size: 10px;
}
td {
font-size: 8px;
}
</style>
</head>
<body>
<!--This is my table with smaller text: -->
<table>
<tr><td>this text is:</td><td>8px</td></tr>
</table>
</body>
</html>
Desired output:
<html>
<head>
</head>
<body style="font-size: 10px;">
<!-- This is my table with smaller text: -->
<table>
<tr><td style="font-size: 8px;">this text is:</td><td style="font-size: 8px;">8px</td></tr>
</table>
</body>
</html>
Why? I want my app to include original emails with replies without the original message styles messing with the format of the reply. I'm guessing this is the way forward for me because when you view the source of a reply in Outlook, it seems to use this method.