Index: branches/5.2.x/core/kernel/utility/email_send.php =================================================================== diff -u -N -r15137 -r15383 --- branches/5.2.x/core/kernel/utility/email_send.php (.../email_send.php) (revision 15137) +++ branches/5.2.x/core/kernel/utility/email_send.php (.../email_send.php) (revision 15383) @@ -1,6 +1,6 @@ ]*?)([\\/]?>)/s', $html, $regs) ) { + $found_tags = Array (); + + foreach ($regs[0] as $index => $tag) { + $tag_placeholder = '%' . md5($index . ':' . $tag) . '%'; + $found_tags[$tag_placeholder] = $tag; + + // we can have duplicate tags -> replace only 1st occurrence (str_replace can't do that) + $html = preg_replace('/' . preg_quote($tag, '/') . '/', $tag_placeholder, $html, 1); + } + + $html = $this->_convertToText($html); + + foreach ($found_tags as $tag_placeholder => $tag) { + $html = str_replace($tag_placeholder, $tag, $html); + } + + return $html; + } + + return $this->_convertToText($html); + } + + /** + * Returns text version of HTML document + * + * @param string $html + * @return string + */ + protected function _convertToText($html) + { $search = Array ( "'(<\/td>.*)[\r\n]+(.*[\r\n]{0,2})|(<\/p>)|(<\/div>)|(<\/tr>)'i",