* 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
This commit is contained in:
Ralf Becker 2015-06-19 14:21:18 +00:00
parent c5d224b87c
commit ab6f9f455c

View File

@ -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
}