]> git.mxchange.org Git - friendica.git/blobdiff - src/Util/Emailer.php
Update does work now
[friendica.git] / src / Util / Emailer.php
index 7d4205ac3346ec779a34b90024d9b94a4220dc08..4fa5e290576df8c384377a9cb55d66c52f5f2a7e 100644 (file)
@@ -4,6 +4,8 @@
  */
 namespace Friendica\Util;
 
+use Friendica\Core\Addon;
+use Friendica\Core\Config;
 use Friendica\Core\PConfig;
 use Friendica\Protocol\Email;
 
@@ -30,7 +32,7 @@ class Emailer
         */
        public static function send($params)
        {
-               call_hooks('emailer_send_prepare', $params);
+               Addon::callHooks('emailer_send_prepare', $params);
 
                $email_textonly = false;
                if (x($params, "uid")) {
@@ -71,20 +73,28 @@ class Emailer
                $multipartMessageBody .=
                        "--" . $mimeBoundary . "--\n";                                  // message ending
 
+               if (Config::get("system", "sendmail_params", true)) {
+                       $sendmail_params = '-f ' . $params['fromEmail'];
+               } else {
+                       $sendmail_params = null;
+               }
+
                // send the message
-               $hookdata = array(
+               $hookdata = [
                        'to' => $params['toEmail'],
                        'subject' => $messageSubject,
                        'body' => $multipartMessageBody,
-                       'headers' => $messageHeader
-               );
+                       'headers' => $messageHeader,
+                       'parameters' => $sendmail_params
+               ];
                //echo "<pre>"; var_dump($hookdata); killme();
-               call_hooks("emailer_send", $hookdata);
+               Addon::callHooks("emailer_send", $hookdata);
                $res = mail(
-                       $hookdata['to'],                                                        // send to address
-                       $hookdata['subject'],                                           // subject
-                       $hookdata['body'],                                                      // message body
-                       $hookdata['headers']                                            // message headers
+                       $hookdata['to'],
+                       $hookdata['subject'],
+                       $hookdata['body'],
+                       $hookdata['headers'],
+                       $hookdata['parameters']
                );
                logger("header " . 'To: ' . $params['toEmail'] . "\n" . $messageHeader, LOGGER_DEBUG);
                logger("return value " . (($res)?"true":"false"), LOGGER_DEBUG);