diff --git a/mail.php b/mail.php index d00cc70..bdff951 100644 --- a/mail.php +++ b/mail.php @@ -228,7 +228,8 @@ class mail $this->sections = array (); $this->completeEmailEML = $content; $partinfo = $this->parseMessagePart ($content); - $this->readMailContentRecurse ($partinfo); + if ($partinfo !== null) + $this->readMailContentRecurse ($partinfo); } /** Read the content of the mail and allow the content to be also multipart. @@ -272,6 +273,8 @@ class mail if ($parts[$i] === "") continue; $messagePart = $this->parseMessagePart ($parts[$i]); + if ($messagePart === null) + continue; $messagePart["_parentID"] = $sectionIDParent; $sectionIDChild = $this->sectionAdd ($messagePart); $this->sectionAddChild ($sectionIDParent, $sectionIDChild); @@ -342,7 +345,7 @@ class mail //trigger_error ("Malformed mail provided: no section header", // E_USER_NOTICE); $prev = ""; - break; + continue; } list ($head, $value) = $exp; $value .= $prevCR; @@ -365,10 +368,16 @@ class mail } $contentType = $this->getHeaderValue ("Content-Type", $headersArray); if ($contentType === false) - throw new \Exception ("No Content-Type Header defined", 500); + { + //throw new \Exception ("No Content-Type Header defined", 500); + return; + } $contentTypeArray = $this->contentTypeAnalyze ($contentType); if (! isset ($contentTypeArray["Content-Type"])) - throw new \Exception ("Can't parse the Content-Type", 500); + { + //throw new \Exception ("Can't parse the Content-Type", 500); + return; + } $contentTransferEncoding = $this->getHeaderValue ("Content-Transfer-Encoding", $headersArray);