Skip to content

Commit 8661ca9

Browse files
BUG: Plaintext version of message is cut off
1 parent ddbb6e5 commit 8661ca9

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

lib/MailSo/Base/HtmlUtils.php

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -766,8 +766,6 @@ public static function ConvertHtmlToPlain($sText)
766766
'/<th[^>]*>(.+?)<\/th>/i',
767767
'/&nbsp;/i',
768768
'/&quot;/i',
769-
'/&gt;/i',
770-
'/&lt;/i',
771769
'/&amp;/i',
772770
'/&copy;/i',
773771
'/&trade;/i',
@@ -810,8 +808,6 @@ public static function ConvertHtmlToPlain($sText)
810808
"\t\\1\n",
811809
' ',
812810
'"',
813-
'>',
814-
'<',
815811
'&',
816812
'(c)',
817813
'(tm)',
@@ -835,9 +831,18 @@ public static function ConvertHtmlToPlain($sText)
835831

836832
$sText = str_ireplace('<div>',"\n<div>", $sText);
837833
$sText = strip_tags($sText, '');
834+
835+
// angle brackets must be replaced after the strip_tags function call to prevent replacing some text after < symbol
836+
$sText = preg_replace(array(
837+
'/&gt;/i',
838+
'/&lt;/i',
839+
), array(
840+
'>',
841+
'<',
842+
), $sText);
843+
838844
$sText = preg_replace("/\n\\s+\n/", "\n", $sText);
839845
$sText = preg_replace("/[\n]{3,}/", "\n\n", $sText);
840-
841846
return trim($sText);
842847
}
843848

0 commit comments

Comments
 (0)