From 43a45b59c4ec68fa2668cb946b966e3681729da6 Mon Sep 17 00:00:00 2001 From: Dominique Fournier Date: Tue, 13 Jun 2017 09:18:56 +0000 Subject: [PATCH] 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 --- mail.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mail.php b/mail.php index aa90350..151fb36 100644 --- a/mail.php +++ b/mail.php @@ -374,8 +374,9 @@ class mail $contentType = $this->getHeaderValue ("Content-Type", $headersArray); if ($contentType === false) { - //throw new \Exception ("No Content-Type Header defined", 500); - return; + // If the mail doesn't provide a Content-Type header, it is then a raw + // text mail. Force the Content-Type to continue; + $contentType = "text/plain; charset=utf-8; format=flowed"; } $contentTypeArray = $this->contentTypeAnalyze ($contentType); if (! isset ($contentTypeArray["Content-Type"])) @@ -1397,7 +1398,7 @@ class mail return quoted_printable_decode ($content); elseif ($encoding === "base64") return base64_decode ($content); - elseif ($encoding === "8bit" || $encoding === "7bit") + elseif ($encoding === "8bit" || $encoding === "7bit" || $encoding === false) return $content; throw new \Exception (sprintf ( _("Invalid encoding provided to encodingDecode : '%s'"),