The very right way here is to use any DOM processor that will get visible text part of ```$html```,
but it's too much unneeded compexity for simple text representation of email.

Can add body check, but don't think it's right.
```php
                if (preg_match('|<body[^>]*>(.*?)</body>|is', $html, $match)) {
                    $html = $match[1];
                }
                $html = preg_replace('|<style[^>]*>(.*?)</style>|is', '', $html);
```

Email with HTML: 
```html
Injected visible text
<html>
    <head></head>
    <body>
        <div>Content Block</div>
    </body>
</html>
```
will render in Gmail with 'Injected visible text' string.

TEXT version of Email and visible part of HTML should match, visible text for this HTML should be: 
```html
Some injected  text
Content Block
```