Skip to content

[Bug]: SVG theming logo is embedded in emails as PNG data labelled image/svg+xml, so it doesn’t display #66567

Description

@dci-krahimbux

⚠️ This issue respects the following points: ⚠️

  • This is not a troubleshooting question, general support matter, or webserver/proxy problem, but likely a bug (if unsure, ask the Community Help Forum).
  • This issue is not already reported on Github OR solved at the Community Help Forum (I've searched!).
  • I'm using a maintained major version of Nextcloud Server and tested against the latest patch level. (Supported major versions and current patch levels).
  • I agree to follow Nextcloud's Code of Conduct.
  • I've tried my best to provide clear reproduction steps that someone unfamiliar with this bug could use to reproduce it.

Bug description

With a custom SVG theming logo, the logo doesn't display in emails sent with the standard email template. The HTML references the inline part (<img class="logo float-center" src="cid:…@symfony" …>), but Outlook doesn't render it.

ThemingDefaults::getLogoImage() requests a non-SVG logo, so for an SVG upload ImageManager::getImage() converts it to PNG (when Imagick supports SVG) and returns the cached logo.png file. The MIME type, however, comes from the stored upload type:

// apps/theming/lib/ThemingDefaults.php
$file = $this->imageManager->getImage('logo', false);
return ['content' => $file->getContent(), 'mimeType' => $this->imageManager->getImageMime('logo')];

For an SVG logo, logoMime is image/svg+xml, so Message::useTemplate() attaches PNG data with Content-Type: image/svg+xml.

This is a regression from #64327 (the fix for #64308), backported in #64409 / #64410, so it affects 34.0.5+, 35.0.1+ and master. Before it, $file->getMimeType() returned image/png for the converted logo.png; only the extensionless original (logo) fell back to application/octet-stream.

Related: #64412 (same symptom in Outlook, for the PNG case fixed by #64327), and the comment on #62933 about large PNG renders of SVG logos.

Possible fix: use image/png when getImage() returned the converted file, e.g.

$file = $this->imageManager->getImage('logo', false);
$mimeType = $file->getName() === 'logo.png' ? 'image/png' : $this->imageManager->getImageMime('logo');
return ['content' => $file->getContent(), 'mimeType' => $mimeType];

If the conversion isn't possible (no Imagick SVG support), the original SVG is embedded with the correct type, but most mail clients (Outlook, Gmail) don't render SVG in emails either, so linking to the logo URL as before might be the better fallback in that case.

Steps to reproduce

  1. Run Nextcloud 35.0.1+ (or 34.0.5+) with Imagick SVG support, e.g. the official nextcloud:35-apache Docker image.
  2. Set an SVG logo: occ theming:config logo /path/to/logo.svg (or upload it under Administration settings → Theming).
  3. Send any email that uses the email template, e.g. an Announcement Center announcement with email enabled, or a suspicious login notification.
  4. Open the email in Outlook: the logo is missing.

Expected behavior

The logo displays, i.e. the inline part is labelled image/png when the PNG conversion is attached.

Nextcloud Server version

35

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.5

Web server

Apache (supported)

Database engine version

MariaDB

Is this bug present after an update or on a fresh install?

Upgraded to a MAJOR version (ex. 31 to 32)

Are you using the Nextcloud Server Encryption module?

Encryption is Disabled

What user-backends are you using?

  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other

Configuration report

List of activated Apps

Nextcloud Signing status

Nextcloud Logs

Additional info

Disclaimer: I'm not a programmer. AI was used to diagnose this issue, and write this report.

A workaround if anybody else is experiencing this is to set a PHP logo. We use a before-starting hook to set the logo, so I modified mine to do this for us, with the logo mounted into the image at /logo.svg:

#!/bin/bash
set -euo pipefail

LOGO_SVG=/logo.svg
LOGO_PNG=/tmp/logo.png
LOGO_MAX_PX=420 # longest side, emails display the logo at max 105px, so this stays sharp on high-DPI screens

# The header logo is only used in the web UI, which renders SVG fine
php occ theming:config logoheader "$LOGO_SVG"

# Uses PHP's Imagick (the same SVG support Nextcloud uses), the image has no ImageMagick CLI
if ! LOGO_SVG="$LOGO_SVG" LOGO_PNG="$LOGO_PNG" LOGO_MAX_PX="$LOGO_MAX_PX" php <<'PHP'
<?php
$src = getenv('LOGO_SVG');
$probe = new Imagick($src);
$scale = (int)getenv('LOGO_MAX_PX') / max($probe->getImageWidth(), $probe->getImageHeight());
$im = new Imagick();
$im->setBackgroundColor(new ImagickPixel('transparent'));
$im->setResolution(96 * $scale, 96 * $scale);
$im->readImage($src);
$im->setImageFormat('png32');
$im->stripImage();
$im->writeImage(getenv('LOGO_PNG'));
echo "Rendered $src to {$im->getImageWidth()}x{$im->getImageHeight()} PNG\n";
PHP
then
    echo "Converting $LOGO_SVG to PNG failed, setting the SVG instead (logo won't show in emails)"
    php occ theming:config logo "$LOGO_SVG"
    exit 0
fi

php occ theming:config logo "$LOGO_PNG"
rm -f "$LOGO_PNG"

Activity

  1. islamadel commented on Nov 16, 2026

    @islamadel

    I was about to post the same issue. I noticed the missing logo on iOS Apple Mail App after upgrading Nextcloud to version 34. As a quick fix i replaced my svg logo with png in the theming settings. But of course I wish to be able to use the svg again. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions