mail: allow mails to not have an encoding defined. Then do not transform the result

git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@3756 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
2017-06-13 09:18:56 +00:00
parent b9f593c546
commit 43a45b59c4

View File

@@ -374,8 +374,9 @@ class mail
$contentType = $this->getHeaderValue ("Content-Type", $headersArray); $contentType = $this->getHeaderValue ("Content-Type", $headersArray);
if ($contentType === false) if ($contentType === false)
{ {
//throw new \Exception ("No Content-Type Header defined", 500); // If the mail doesn't provide a Content-Type header, it is then a raw
return; // text mail. Force the Content-Type to continue;
$contentType = "text/plain; charset=utf-8; format=flowed";
} }
$contentTypeArray = $this->contentTypeAnalyze ($contentType); $contentTypeArray = $this->contentTypeAnalyze ($contentType);
if (! isset ($contentTypeArray["Content-Type"])) if (! isset ($contentTypeArray["Content-Type"]))
@@ -1397,7 +1398,7 @@ class mail
return quoted_printable_decode ($content); return quoted_printable_decode ($content);
elseif ($encoding === "base64") elseif ($encoding === "base64")
return base64_decode ($content); return base64_decode ($content);
elseif ($encoding === "8bit" || $encoding === "7bit") elseif ($encoding === "8bit" || $encoding === "7bit" || $encoding === false)
return $content; return $content;
throw new \Exception (sprintf ( throw new \Exception (sprintf (
_("Invalid encoding provided to encodingDecode : '%s'"), _("Invalid encoding provided to encodingDecode : '%s'"),