Skip to content

Commit 85f7cd0

Browse files
urshoferdg
authored andcommitted
Embedding SVG Images in Apple Mail (#53)
Apple Mail for example has a problem displaying svg images with the content-type image/svg. It musst be called image/svg+xml. Correcting this here. Should not be a problem for other mailers.
1 parent d034080 commit 85f7cd0

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/Mail/Message.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,8 @@ private function createAttachment(string $file, string $content = null, string $
303303
}
304304
if (!strcasecmp($contentType, 'message/rfc822')) { // not allowed for attached files
305305
$contentType = 'application/octet-stream';
306+
} elseif (!strcasecmp($contentType, 'image/svg')) { // Troublesome for some mailers...
307+
$contentType = 'image/svg+xml';
306308
}
307309

308310
$part->setBody($content);

0 commit comments

Comments
 (0)