Skip to content

Commit

Permalink
Merge pull request #10763 from nextcloud/fix/noid/html5-and-network-a…
Browse files Browse the repository at this point in the history
…ccess

fix: html5 tag errors
  • Loading branch information
st3iny authored Feb 27, 2025
2 parents 2d1b3b4 + fb4fae1 commit b507ee3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/Service/MimeMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,13 @@ private function buildMessagePart(?string $contentPlain, ?string $contentHtml):

// determine if content is wrapped properly in a html tag, otherwise we need to wrap it properly
if (mb_strpos($contentHtml, '<html') === false) {
$source = '<html><meta http-equiv="content-type" content="text/html; charset=UTF-8"><body>' . $contentHtml . '</body>';
$source = '<!DOCTYPE html><html><meta http-equiv="content-type" content="text/html; charset=UTF-8"><body>' . PHP_EOL . $contentHtml . PHP_EOL . '</body>';
} else {
$source = ' ' . $contentHtml;
}

$doc = new DOMDocument();
$doc->loadHTML($source, LIBXML_HTML_NODEFDTD | LIBXML_HTML_NOIMPLIED);
$doc->loadHTML($source, LIBXML_NONET | LIBXML_HTML_NODEFDTD | LIBXML_HTML_NOIMPLIED);
// determine if content has any embedded images
$embeddedParts = [];
foreach ($doc->getElementsByTagName('img') as $id => $image) {
Expand Down

0 comments on commit b507ee3

Please sign in to comment.