From 78ce4d3aeb65e672b6d5669715f5ea04ac7dbeda Mon Sep 17 00:00:00 2001 From: wangyidong Date: Tue, 7 Jun 2016 13:59:03 +0800 Subject: [PATCH] * code for task #2616. --- module/mail/model.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/module/mail/model.php b/module/mail/model.php index c2d826cac6..e151bc72a7 100644 --- a/module/mail/model.php +++ b/module/mail/model.php @@ -304,8 +304,12 @@ class mailModel extends model catch (phpmailerException $e) { $mailError = ob_get_contents(); - $encoding = mb_detect_encoding($mailError, array("ASCII",'UTF-8',"GB2312","GBK",'BIG5')); - $this->errors[] = nl2br(trim(strip_tags($e->errorMessage()))) . '
' . mb_convert_encoding($mailError, 'utf8', $encoding); + if(extension_loaded('mbstring')) + { + $encoding = mb_detect_encoding($mailError, array('ASCII','UTF-8','GB2312','GBK','BIG5')); + if($encoding != 'UTF-8') $mailError = mb_convert_encoding($mailError, 'utf8', $encoding); + } + $this->errors[] = nl2br(trim(strip_tags($e->errorMessage()))) . '
' . $mailError; } catch (Exception $e) {