@@ -33,6 +33,8 @@ class EMailTemplate implements IEMailTemplate {
3333 protected bool $ bodyListOpened = false ;
3434 /** indicated if the footer is added */
3535 protected bool $ footerAdded = false ;
36+ /** @var array<array{name: string, content: string, mimeType: string}> images to embed inline, referenced via cid: */
37+ protected array $ inlineImages = [];
3638
3739 protected string $ head = <<<EOF
3840<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
@@ -354,8 +356,25 @@ public function addHeader(): void {
354356 $ logoSizeDimensions = ' width=" ' . $ this ->logoWidth . '" height=" ' . $ this ->logoHeight . '" ' ;
355357 }
356358
357- $ logoUrl = $ this ->urlGenerator ->getAbsoluteURL ($ this ->themingDefaults ->getLogo (false ));
358- $ this ->htmlBody .= vsprintf ($ this ->header , [$ this ->themingDefaults ->getDefaultColorPrimary (), $ logoUrl , $ this ->themingDefaults ->getName (), $ logoSizeDimensions ]);
359+ $ logoImage = $ this ->themingDefaults ->getLogoImage ();
360+ if ($ logoImage !== null ) {
361+ // Embed the logo directly in the message instead of linking to it, so mail
362+ // clients don't have to fetch it from the internet (some (e.g. gmail) block that).
363+ $ logoSrc = 'cid:logo ' ;
364+ $ this ->inlineImages [] = ['name ' => 'logo ' ] + $ logoImage ;
365+ } else {
366+ $ logoSrc = $ this ->urlGenerator ->getAbsoluteURL ($ this ->themingDefaults ->getLogo (false ));
367+ }
368+ $ this ->htmlBody .= vsprintf ($ this ->header , [$ this ->themingDefaults ->getDefaultColorPrimary (), $ logoSrc , $ this ->themingDefaults ->getName (), $ logoSizeDimensions ]);
369+ }
370+
371+ /**
372+ * Images that must be embedded inline in the message, referenced via `cid:<name>` in the HTML body
373+ *
374+ * @return array<array{name: string, content: string, mimeType: string}>
375+ */
376+ public function getInlineImages (): array {
377+ return $ this ->inlineImages ;
359378 }
360379
361380 /**
0 commit comments