Index: trunk/core/kernel/utility/email.php =================================================================== diff -u -r1560 -r1940 --- trunk/core/kernel/utility/email.php (.../email.php) (revision 1560) +++ trunk/core/kernel/utility/email.php (.../email.php) (revision 1940) @@ -115,48 +115,49 @@ } function compileBody(){ - if($this->BodyHtml){ - $search = array ( - "'(<\/td>.*)[\r\n]+(.*)|(<\/p>)|(<\/div>)|(<\/tr>)'i", - "'(.*?)'si", - "''si", - "'(.*?)'si", - "''si", + $search = array ( + "'(<\/td>.*)[\r\n]+(.*)|(<\/p>)|(<\/div>)|(<\/tr>)'i", + "'(.*?)'si", + "''si", + "'(.*?)'si", + "''si", // "'^[\s\n\r\t]+'", //strip all spacers & newlines in the begin of document // "'[\s\n\r\t]+$'", //strip all spacers & newlines in the end of document - "'&(quot|#34);'i", - "'&(amp|#38);'i", - "'&(lt|#60);'i", - "'&(gt|#62);'i", - "'&(nbsp|#160);'i", - "'&(iexcl|#161);'i", - "'&(cent|#162);'i", - "'&(pound|#163);'i", - "'&(copy|#169);'i", - "'&#(\d+);'e" - ); + "'&(quot|#34);'i", + "'&(amp|#38);'i", + "'&(lt|#60);'i", + "'&(gt|#62);'i", + "'&(nbsp|#160);'i", + "'&(iexcl|#161);'i", + "'&(cent|#162);'i", + "'&(pound|#163);'i", + "'&(copy|#169);'i", + "'&#(\d+);'e" + ); - $replace = array ( - "\\1\t\\2", - "\n\r", - "", - "", - "", - "", + $replace = array ( + "\\1\t\\2", + "\n\r", + "", + "", + "", + "", // "", // "", - "\"", - "&", - "<", - ">", - " ", - chr(161), - chr(162), - chr(163), - chr(169), - "chr(\\1)" - ); + "\"", + "&", + "<", + ">", + " ", + chr(161), + chr(162), + chr(163), + chr(169), + "chr(\\1)" + ); + if($this->BodyHtml){ + $not_html = preg_replace ($search, $replace, $this->BodyHtml); $not_html = strip_tags($not_html); @@ -189,16 +190,23 @@ $this->IsMultipart = true; }else{ + $not_html = preg_replace ($search, $replace, $this->BodyText); + $not_html = strip_tags($not_html); +// $not_html = $this->removeBlankLines($not_html); + // Fixing problem with add exclamation characters "!" into the body of the email. + $not_html = wordwrap($not_html, 72); + + if ($this->IsMultipart){ $this->Body .= '------='.$this->EmailBoundary.$this->LF(); $this->Body .= 'Content-Type: text/plain;'.$this->LF()." ".'charset="'.$this->Charset.'"'.$this->LF(); $this->Body .= 'Content-Disposition: inline'.$this->LF(); $this->Body .= $this->LF(); $this->Body .= $not_html.$this->LF().$this->LF(); }else{ - $this->BodyText = str_replace("\r", "", $this->BodyText); - $this->BodyText = str_replace("\n", $this->LF(), $this->BodyText); - $this->Body = $this->BodyText; + //$this->BodyText = str_replace("\r", "", $this->BodyText); + //$this->BodyText = str_replace("\n", $this->LF(), $this->BodyText); + $this->Body = $not_html; } }