src/MimeMailer/MimeMessage.php
public function setText($text = '', $clear = false)
    {
        if (true===$clear) {
            $this->clear('text');
        }
        if ('auto'==$text) {
            if (!empty($this->html)) {
                $html_content = preg_replace("/.*<body[^>]*>|<\/body>.*/si", "", $this->html);
                $this->text .= Helper::formatText(Helper::html2text($html_content));
            }
        } else {
            $this->text .= Helper::formatText($text);
        }
        return $this;
    }
public function setText($text = '', $clear = false)
    {
        if (true===$clear) {
            $this->clear('text');
        }
        if ('auto'==$text) {
            if (!empty($this->html)) {
                $html_content = preg_replace("/.*<body[^>]*>|<\/body>.*/si", "", $this->html);
                $this->text .= Helper::formatText(Helper::html2text($html_content));
            }
        } else {
            $this->text .= Helper::formatText($text);
        }
        return $this;
    }
public function setText ( $ text = '' , $ clear = false ) { if ( true === $ clear ) { $ this -> clear ( 'text' ) ; } if ( 'auto' == $ text ) { if ( ! empty ( $ this -> html ) ) { $ html_content = preg_replace ( "/.*<body[^>]*>|<\/body>.*/si" , "" , $ this -> html ) ; $ this -> text .= Helper :: formatText ( Helper :: html2text ( $ html_content ) ) ; } } else { $ this -> text .= Helper :: formatText ( $ text ) ; } return $ this ; }
Set plain text version

If $text='auto', the text version will be generated from the HTML content

@param string $text The plain text content or keyword 'auto' to auto-generate it from the HTML content
@param bool $clear Clear a set content first ? (default is to append a content)
@return self
Set plain text version