Skip to content

Commit

Permalink
Add the possiblity to add images inline in mails
Browse files Browse the repository at this point in the history
  • Loading branch information
rubofvil committed Sep 2, 2015
1 parent 0e247e3 commit aa11061
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 9 deletions.
19 changes: 15 additions & 4 deletions CRM/Mailing/BAO/Mailing.php
Original file line number Diff line number Diff line change
Expand Up @@ -1260,10 +1260,21 @@ public function &compose($job_id, $event_queue_id, $hash, $contactId,

if (!empty($mailParams['attachments'])) {
foreach ($mailParams['attachments'] as $fileID => $attach) {
$message->addAttachment($attach['fullPath'],
$attach['mime_type'],
$attach['cleanName']
);
if(isset($attach['is_image']) && $attach['is_image'] = TRUE ){
$message->addHTMLImage(
$attach['fullPath'],
$attach['c_type'],
$attach['name'],
$attach['is_file'],
$attach['content_id']
);
}
else{
$message->addAttachment($attach['fullPath'],
$attach['mime_type'],
$attach['cleanName']
);
}
}
}

Expand Down
21 changes: 16 additions & 5 deletions CRM/Utils/Mail.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,22 @@ static function send(&$params) {

if (!empty($attachments)) {
foreach ($attachments as $fileID => $attach) {
$msg->addAttachment(
$attach['fullPath'],
$attach['mime_type'],
$attach['cleanName']
);
if(isset($attach['is_image']) && $attach['is_image'] = TRUE ){
$msg->addHTMLImage(
$attach['fullPath'],
$attach['c_type'],
$attach['name'],
$attach['is_file'],
$attach['content_id']
);
}
else{
$msg->addAttachment(
$attach['fullPath'],
$attach['mime_type'],
$attach['cleanName']
);
}
}
}

Expand Down

0 comments on commit aa11061

Please sign in to comment.