1

I need a way to get a HTML from an email without attributes (class / styles).

Currently trying the following:

$crawler = new Crawler();
$crawler->addHtmlContent($mail->textHtml);

$html = '';
$nodes = $crawler->filter('body > *'); //only stuff inside body

foreach ($crawler as $domElement) {
    //remove somehow class+styles ?
    $html .= $domElement->ownerDocument->saveHTML($domElement);
}

echo $html; //outputs everything inside body (currently with attributes)

As I read on many questions already, regex is not a good solutions for something like this as it may break stuff.

Syllz
  • 290
  • 6
  • 22

0 Answers0