mail : if addAttachmentInline, start the HTML to be mail compliant. Raise an exception if the html part is not provided before using getMail ();

git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@3126 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
2016-10-11 12:14:45 +00:00
parent c213e40606
commit 85c6505ff0

View File

@@ -735,6 +735,8 @@ class mail
public function addAttachment ($name, $fileContent, $encoding="base64",
$inline=false)
{
if ($this->getBodyHTML() === false && $inline !== false)
$this->setBodyHTML ("No HTML provided by inline file added");
// Look if there is a multipart/mixed where adding the new section. If not,
// create it
$multipart = ($inline === false) ? "multipart/mixed" : "multipart/related";
@@ -1252,6 +1254,9 @@ class mail
*/
public function getMail ()
{
if (trim ($this->getBodyHTML()) === "No HTML provided by inline file added")
throw new \Exception ("No HTML provided by inline file added", 500);
return $this->completeEmailEML;
}