images can be passed to toIndividual() for adding it to the html part

This commit is contained in:
Uwe Steinmann 2022-02-02 21:36:27 +01:00
parent aa8eb38560
commit 35b8b9b703

View File

@ -83,7 +83,7 @@ class SeedDMS_EmailNotify extends SeedDMS_Notify {
* @param array $attachments list of attachments
* @return false or -1 in case of error, otherwise true
*/
function toIndividual($sender, $recipient, $subject, $messagekey, $params=array(), $attachments=array()) { /* {{{ */
function toIndividual($sender, $recipient, $subject, $messagekey, $params=array(), $attachments=array(), $images=array()) { /* {{{ */
if(is_object($recipient) && $recipient->isType('user') && !$recipient->isDisabled() && $recipient->getEmail()!="") {
$to = $recipient->getEmail();
$lang = $recipient->getLanguage();
@ -158,6 +158,19 @@ class SeedDMS_EmailNotify extends SeedDMS_Notify {
if($bodyhtml)
$mime->setHTMLBody($bodyhtml);
if($images) {
foreach($images as $image) {
if(!$mime->addHTMLImage(
$image['file'],
$image['mimetype'],
isset($image['name']) ? $image['name'] : '',
isset($image['isfile']) ? $image['isfile'] : true
)) {
return false;
}
}
}
if($attachments) {
foreach($attachments as $attachment) {
if(!$mime->addAttachment(