From 1c6eb939513e95b7f56cc865eeb0ea76a2c9563f Mon Sep 17 00:00:00 2001 From: Jerome Nadaud Date: Wed, 7 Aug 2013 17:08:01 +0200 Subject: [PATCH] [-] BO : Check if function mb_encode_mimeheader exist in case some user uninstall it --- classes/Mail.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/classes/Mail.php b/classes/Mail.php index 12c189568..69c8ca91f 100644 --- a/classes/Mail.php +++ b/classes/Mail.php @@ -147,7 +147,10 @@ class MailCore if ($to_name == null) $to_name = $addr; /* Encode accentuated chars */ - $to_list->addTo($addr, mb_encode_mimeheader($to_name, 'utf-8')); + if (function_exists('mb_encode_mimeheader')) + $to_list->addTo($addr, mb_encode_mimeheader($to_name, 'utf-8')); + else + $to_list->addTo($addr, '=?UTF-8?B?'.base64_encode($to_name).'?='); } $to_plugin = $to[0]; $to = $to_list; @@ -156,7 +159,10 @@ class MailCore $to_plugin = $to; if ($to_name == null) $to_name = $to; - $to = new Swift_Address($to, mb_encode_mimeheader($to_name, 'utf-8')); + if (function_exists('mb_encode_mimeheader')) + $to = new Swift_Address($to, mb_encode_mimeheader($to_name, 'utf-8')); + else + $to = new Swift_Address($to, '=?UTF-8?B?'.base64_encode($to_name).'?='); } try { /* Connect with the appropriate configuration */