Pimcore\Mail::html2Text PHP Method

html2Text() protected method

protected html2Text ( $htmlContent ) : string
$htmlContent
return string
    protected function html2Text($htmlContent)
    {
        if ($this->getHtml2TextBinaryEnabled()) {
            $content = "";
            //html2text doesn't support unicode
            if ($this->getCharset() == "UTF-8") {
                $htmlContent = utf8_decode($htmlContent);
            }
            //using temporary file so we don't have problems with special characters
            $tmpFileName = PIMCORE_SYSTEM_TEMP_DIRECTORY . "/" . uniqid('email_', true) . ".tmp";
            if (\Pimcore\File::put($tmpFileName, $htmlContent)) {
                $content = @shell_exec("html2text {$tmpFileName} " . $this->getHtml2TextOptions());
                @unlink($tmpFileName);
            }
            return $content;
        }
        return "";
    }