From ff5bf040e8594485be07690eda2192d4d9206d8b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 21 Apr 2020 11:19:27 +0200 Subject: [PATCH] FIX text version of html emailing (removed the body style) --- htdocs/core/class/smtps.class.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/smtps.class.php b/htdocs/core/class/smtps.class.php index f80d2f1547a..df7647b330c 100644 --- a/htdocs/core/class/smtps.class.php +++ b/htdocs/core/class/smtps.class.php @@ -1379,9 +1379,10 @@ class SMTPs $strContentAltText = ''; if ($strType == 'html') { - // Similar code to forge a text from html is also in CMailFile.class.php - $strContentAltText = preg_replace("/]*>/", " ", $strContent); - $strContentAltText = html_entity_decode(strip_tags($strContentAltText)); + // Similar code to forge a text from html is also in CMailFile.class.php + $strContentAltText = preg_replace('/.*<\/style><\/head>/', '', $strContent); + $strContentAltText = preg_replace("/<br\s*[^>]*>/", " ", $strContentAltText); + $strContentAltText = html_entity_decode(strip_tags($strContentAltText)); $strContentAltText = trim(wordwrap($strContentAltText, 75, "\r\n")); }