mail: allow header to be set to empty

git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@3710 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
2017-05-20 18:59:53 +00:00
parent d551a70e53
commit 8658bd8a86

View File

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