From 2d63cfb10dcf7fb984877e96f5bc18acb93f7233 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Fri, 19 Jun 2015 14:20:57 +0000 Subject: [PATCH] * Mail: inline images were not shown in Thunderbird we need to send a multipart/related with html-body as first part and inline images as further parts --- phpgwapi/inc/class.egw_mailer.inc.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/phpgwapi/inc/class.egw_mailer.inc.php b/phpgwapi/inc/class.egw_mailer.inc.php index b432760586..06e00910e2 100644 --- a/phpgwapi/inc/class.egw_mailer.inc.php +++ b/phpgwapi/inc/class.egw_mailer.inc.php @@ -452,6 +452,28 @@ class egw_mailer extends Horde_Mime_Mail 'message_id' => (string)$message_id, ), array(), true); // true = call all apps + // check if we are sending an html mail with inline images + if (!empty($this->_htmlBody) && count($this->_parts)) + { + $related = null; + foreach($this->_parts as $n => $part) + { + if ($part->getDisposition() == 'inline' && $part->getContentId()) + { + // we need to send a multipart/related with html-body as first part and inline images as further parts + if (!isset($related)) + { + $related = new Horde_Mime_Part(); + $related->setType('multipart/related'); + $related[] = $this->_htmlBody; + $this->_htmlBody = $related; + } + $related[] = $part; + unset($this->_parts[$n]); + } + } + } + try { parent::send($this->account->smtpTransport(), true, // true: keep Message-ID $this->_body->getType() != 'multipart/encrypted'); // no flowed for encrypted messages