fix inline images with swiftmailer (#29923)

This commit is contained in:
Frédéric FRANCE 2024-06-08 12:00:23 +02:00 committed by GitHub
parent bcf7354ad6
commit 84491bfbdd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -709,6 +709,14 @@ class CMailFile
}
if ($this->atleastoneimage) {
foreach ($this->html_images as $img) {
// $img['fullpath'],$img['image_encoded'],$img['name'],$img['content_type'],$img['cid']
$attachment = Swift_Image::fromPath($img['fullpath']);
// embed image
$imgcid = $this->message->embed($attachment);
// replace cid by the one created by swiftmail in html message
$msg = str_replace("cid:".$img['cid'], $imgcid, $msg);
}
foreach ($this->images_encoded as $img) {
//$img['fullpath'],$img['image_encoded'],$img['name'],$img['content_type'],$img['cid']
$attachment = Swift_Image::fromPath($img['fullpath']);