From 85c6505ff02455c422c3ec167f25358da0811d13 Mon Sep 17 00:00:00 2001 From: Dominique Fournier Date: Tue, 11 Oct 2016 12:14:45 +0000 Subject: [PATCH] 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 --- mail.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mail.php b/mail.php index e8e75fd..eac4a81 100644 --- a/mail.php +++ b/mail.php @@ -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; }