WordPress at a glance
function is not described


PHPMailer::html2text() public WP 1.0

Convert an HTML string into plain text. This is used by msgHTML(). Note - older versions of this function used a bundled advanced converter which was removed for license reasons in #232. Example usage:

//Use default conversion
$plain = $mail->html2text($html);
//Use your own custom converter
$plain = $mail->html2text($html, function($html) {
	$converter = new MyHtml2text($html);
	return $converter->get_text();

{} It's a method of the class: PHPMailer{}

No Hooks.




$PHPMailer = new PHPMailer();
$PHPMailer->html2text( $html, $advanced );
$html(string) (required)
The HTML text to convert
Any boolean value to use the internal converter, or provide your own callable for custom conversion

Code of PHPMailer::html2text() WP 5.7.2

public function html2text($html, $advanced = false)
    if (is_callable($advanced)) {
        return call_user_func($advanced, $html);

    return html_entity_decode(
        trim(strip_tags(preg_replace('/<(head|title|style|script)[^>]*>.*?<\/\\1>/si', '', $html))),