]> git.mxchange.org Git - friendica.git/commitdiff
Add Missing Fifth Argument to mail() Function Call
authormiqrogroove <miqrogroove@gmail.com>
Tue, 19 Jun 2018 20:23:42 +0000 (16:23 -0400)
committerGitHub <noreply@github.com>
Tue, 19 Jun 2018 20:23:42 +0000 (16:23 -0400)
This is desperately needed to fix Issue #5190.  In case of any unexpected problem, the admin can use

`$a->config['system']['sendmail_params'] = false;`

src/Util/Emailer.php

index 7d35e54417eb5452c3b52a39fb9dacde87e317b6..c58c234df0c5163ba3b1653b60ecfb86d0641bd6 100644 (file)
@@ -72,20 +72,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 = [
                        'to' => $params['toEmail'],
                        'subject' => $messageSubject,
                        'body' => $multipartMessageBody,
-                       'headers' => $messageHeader
+                       'headers' => $messageHeader,
+                       'parameters' => $sendmail_params
                ];
                //echo "<pre>"; var_dump($hookdata); killme();
                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);