Summery Summery

Convert an HTML string into plain text.

Syntax Syntax

PHPMailer::html2text( string $html, boolean|callable $advanced = false )

Description Description

This is used by msgHTML(). Note – older versions of this function used a bundled advanced converter which was been 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();

Parameters Parameters


(Required) The HTML text to convert


(Optional) Any boolean value to use the internal converter, or provide your own callable for custom conversion.

Default value: false

Return Return


Source Source

File: wp-includes/class-phpmailer.php




Leave a Reply