src/Mail/Message.php
protected function buildText(string $html): string
    {
        $text = Strings::replace($html, [
            '#<(style|script|head).*</\\1>#Uis' => '',
            '#<t[dh][ >]#i' => ' $0',
            '#<a\s[^>]*href=(?|"([^"]+)"|\'([^\']+)\')[^>]*>(.*?)</a>#is' => '$2 &lt;$1&gt;',
            '#[\r\n]+#' => ' ',
            '#<(/?p|/?h\d|li|br|/tr)[ >/]#i' => "\n$0",
        ]);
        $text = \html_entity_decode(\strip_tags($text), ENT_QUOTES, 'UTF-8');
        $text = Strings::replace($text, '#[ \t]+#', ' ');

        return \trim($text);
    }
protected function buildText(string $html): string
    {
        $text = Strings::replace($html, [
            '#<(style|script|head).*</\\1>#Uis' => '',
            '#<t[dh][ >]#i' => ' $0',
            '#<a\s[^>]*href=(?|"([^"]+)"|\'([^\']+)\')[^>]*>(.*?)</a>#is' => '$2 &lt;$1&gt;',
            '#[\r\n]+#' => ' ',
            '#<(/?p|/?h\d|li|br|/tr)[ >/]#i' => "\n$0",
        ]);
        $text = \html_entity_decode(\strip_tags($text), ENT_QUOTES, 'UTF-8');
        $text = Strings::replace($text, '#[ \t]+#', ' ');

        return \trim($text);
    }
protected function buildText ( string $ html ) : string { $ text = Strings :: replace ( $ html , [ '#<(style|script|head).*</\\1>#Uis' => '' , '#<t[dh][ >]#i' => ' $0' , '#<a\s[^>]*href=(?|"([^"]+)"|\'([^\']+)\')[^>]*>(.*?)</a>#is' => '$2 &lt;$1&gt;' , '#[\r\n]+#' => ' ' , '#<(/?p|/?h\d|li|br|/tr)[ >/]#i' => "\n$0" , ] ) ; $ text = \ html_entity_decode ( \ strip_tags ( $ text ) , ENT_QUOTES , 'UTF-8' ) ; $ text = Strings :: replace ( $ text , '#[ \t]+#' , ' ' ) ; return \ trim ( $ text ) ; }
Builds text content.

@param string $html

@return string
@throws RegexpException
Builds text content .