From: Michael M Slusarz Date: Mon, 28 Jun 2010 20:29:31 +0000 (-0600) Subject: Request #9099: Add config option to disable multipart/related conversions X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=d2f9d03d6c60cd28c6f841cd251a8ac7415a6621;p=horde.git Request #9099: Add config option to disable multipart/related conversions --- diff --git a/imp/config/conf.xml b/imp/config/conf.xml index 52a5f3ede..2e8413272 100644 --- a/imp/config/conf.xml +++ b/imp/config/conf.xml @@ -171,6 +171,13 @@ 0 + true 200000 diff --git a/imp/docs/CHANGES b/imp/docs/CHANGES index 8e395c930..165026059 100644 --- a/imp/docs/CHANGES +++ b/imp/docs/CHANGES @@ -2,6 +2,8 @@ v5.0-git -------- +[mms] Add config option to disable multipart/related conversions + (Request #9099). [mms] Sentmail SQL driver now supports split read/write operation. [mms] Pass compose message data to mailer backend via stream; much more efficient, especially with larger messages (Request #8909). diff --git a/imp/lib/Compose.php b/imp/lib/Compose.php index 997628a2d..ca50e0595 100644 --- a/imp/lib/Compose.php +++ b/imp/lib/Compose.php @@ -1081,10 +1081,12 @@ class IMP_Compose $textpart->setHeaderCharset($charset); if (empty($options['nofinal'])) { - $textpart->addPart($this->_convertToMultipartRelated($htmlBody)); - } else { - $textpart->addPart($htmlBody); + try { + $htmlBody = $this->_convertToMultipartRelated($htmlBody); + } catch (Horde_Exception $e) {} } + + $textpart->addPart($htmlBody); } else { $textpart = $textBody; } @@ -2258,9 +2260,11 @@ class IMP_Compose { global $conf; - /* Return immediately if this is not a HTML part, or no 'img' tags are + /* Return immediately if related conversion is turned off via + * configuration, this is not a HTML part, or no 'img' tags are * found (specifically searching for the 'src' parameter). */ - if (($mime_part->getType() != 'text/html') || + if (empty($conf['compose']['convert_to_related']) || + ($mime_part->getType() != 'text/html') || !preg_match_all('/]+src\s*\=\s*([^\s]+)\s+/iU', $mime_part->getContents(), $results)) { return $mime_part; }