From 86c3974d0984daf33d6d60c5924c4bc44417193a Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Thu, 27 Nov 2014 12:29:16 +0000 Subject: [PATCH] get inline images in mail working again --- phpgwapi/inc/class.egw_mailer.inc.php | 30 +++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/phpgwapi/inc/class.egw_mailer.inc.php b/phpgwapi/inc/class.egw_mailer.inc.php index 819fd525fe..86bbf0da57 100644 --- a/phpgwapi/inc/class.egw_mailer.inc.php +++ b/phpgwapi/inc/class.egw_mailer.inc.php @@ -310,6 +310,34 @@ class egw_mailer extends Horde_Mime_Mail return $this->addMimePart($part); } + /** + * Adds an embedded image or other inline attachment + * + * @param string $path Path to the attachment. + * @param string $cid Content ID of the attachment. Use this to identify + * the Id for accessing the image in an HTML form. + * @param string $name Overrides the attachment name. + * @param string $type File extension (MIME) type. + * @return integer part-number + */ + public function addEmbeddedImage($path, $cid, $name = '', $type = 'application/octet-stream') + { + // deprecated PHPMailer::AddEmbeddedImage($path, $cid, $name='', $encoding='base64', $type='application/octet-stream') call + if ($type === 'base64' || func_num_args() == 5) + { + $type = func_get_arg(4); + } + + $part_id = $this->addAttachment($path, $name, $type); + error_log(__METHOD__."('$path', '$cid', '$name', '$type') added with (temp.) part_id=$part_id"); + + $part = $this->_parts[$part_id]; + $part->setDisposition('inline'); + $part->setContentId($cid); + + return $part_id; + } + /** * Adds a string or binary attachment (non-filesystem) to the list. * @@ -646,6 +674,8 @@ class egw_mailer extends Horde_Mime_Mail { switch($name) { + case '_bcc': + return $this->_bcc; // this is NOT PHPMailer compatibility, but quietening below log, if $this->_bcc is NOT set case 'Sender': return $this->getHeader('Return-Path'); case 'From':