]> git.mxchange.org Git - friendica.git/blobdiff - src/Util/Emailer.php
Merge pull request #7199 from MrPetovan/bug/7171-filer-network
[friendica.git] / src / Util / Emailer.php
index e9bcbc200db0da4bd8db366b76cb8ccdd3ca2819..4310046c234411b1f6fd6907f8613a4075ebc7c3 100644 (file)
@@ -19,22 +19,29 @@ class Emailer
         * Send a multipart/alternative message with Text and HTML versions
         *
         * @param array $params parameters
-        *                      fromName name of the sender
-        *                      fromEmail                        email fo the sender
-        *                      replyTo                      replyTo address to direct responses
-        *                      toEmail                      destination email address
-        *                      messageSubject       subject of the message
-        *                      htmlVersion                  html version of the message
-        *                      textVersion                  text only version of the message
-        *                      additionalMailHeader additions to the smtp mail header
+        *                      fromName             name of the sender
+        *                      fromEmail            email of the sender
+        *                      replyTo              address to direct responses
+        *                      toEmail              destination email address
+        *                      messageSubject       subject of the message
+        *                      htmlVersion          html version of the message
+        *                      textVersion          text only version of the message
+        *                      additionalMailHeader additions to the SMTP mail header
         *                      optional             uid user id of the destination user
         *
-        * @return object
+        * @return bool
+        * @throws \Friendica\Network\HTTPException\InternalServerErrorException
         */
-       public static function send($params)
+       public static function send(array $params)
        {
+               $params['sent'] = false;
+
                Hook::callAll('emailer_send_prepare', $params);
 
+               if ($params['sent']) {
+                       return true;
+               }
+
                $email_textonly = false;
                if (!empty($params['uid'])) {
                        $email_textonly = PConfig::get($params['uid'], "system", "email_textonly");
@@ -86,11 +93,16 @@ class Emailer
                        'subject' => $messageSubject,
                        'body' => $multipartMessageBody,
                        'headers' => $messageHeader,
-                       'parameters' => $sendmail_params
+                       'parameters' => $sendmail_params,
+                       'sent' => false,
                ];
 
                Hook::callAll("emailer_send", $hookdata);
 
+               if ($hookdata['sent']) {
+                       return true;
+               }
+
                $res = mail(
                        $hookdata['to'],
                        $hookdata['subject'],