Summery Summery

Create a message body from an HTML string.

Syntax Syntax

PHPMailer::msgHTML( string $message, string $basedir = '', boolean|callable $advanced = false )

Description Description

Automatically inlines images and creates a plain-text version by converting the HTML, overwriting any existing values in Body and AltBody. Do not source $message content from user input! $basedir is prepended when handling relative URLs, e.g. and must not be empty will look for an image file in $basedir/images/a.png and convert it to inline. If you don’t provide a $basedir, relative paths will be left untouched (and thus probably break in email) If you don’t want to apply these transformations to your HTML, just set Body and AltBody directly.

Parameters Parameters


(string) (Required) HTML message string


(string) (Optional) Absolute path to a base directory to prepend to relative paths to images

Default value: ''


(boolean|callable) (Optional) Whether to use the internal HTML to text converter or your own custom converter @see PHPMailer::html2text()

Default value: false

Return Return

(string) $message The transformed message Body

Source Source

File: wp-includes/class-phpmailer.php




Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.