From 3f137a5929ab28f9fbbf85623f5908007be6e764 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Fri, 3 Sep 2010 14:07:45 -0600 Subject: [PATCH] Bug #9216: Fix header encoding on compose Overzealous optimization - there is no away around the fact that we need to call parseAddressList() twice due to the fact that the first use needs to be done before we encode/validate the email string. --- imp/lib/Compose.php | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/imp/lib/Compose.php b/imp/lib/Compose.php index 37ffd8dd6..365ddfe25 100644 --- a/imp/lib/Compose.php +++ b/imp/lib/Compose.php @@ -784,16 +784,6 @@ class IMP_Compose protected function _prepSendMessage($email, $headers = null, $message = null) { - /* Validate the recipient addresses. */ - try { - $alist = Horde_Mime_Address::parseAddressList($email, array( - 'defserver' => $_SESSION['imp']['maildomain'], - 'validate' => true - )); - } catch (Horde_Mime_Exception $e) { - throw new IMP_Compose_Exception($e); - } - $timelimit = $GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_timelimit'); if ($timelimit !== true) { $sentmail = $GLOBALS['injector']->getInstance('IMP_Sentmail'); @@ -808,7 +798,7 @@ class IMP_Compose $recipients = 0; } - foreach ($alist as $address) { + foreach (Horde_Mime_Address::parseAddressList($email) as $address) { $recipients += isset($address['grounpname']) ? count($address['addresses']) : 1; @@ -834,6 +824,12 @@ class IMP_Compose /* Properly encode the addresses we're sending to. */ try { $email = Horde_Mime::encodeAddress($email, is_null($message) ? $GLOBALS['registry']->getCharset() : $message->getHeaderCharset(), $_SESSION['imp']['maildomain']); + + /* Validate the recipient addresses. */ + Horde_Mime_Address::parseAddressList($email, array( + 'defserver' => $_SESSION['imp']['maildomain'], + 'validate' => true + )); } catch (Horde_Mime_Exception $e) { throw new IMP_Compose_Exception($e); } -- 2.11.0