]> git.mxchange.org Git - friendica.git/commitdiff
Merge pull request #5245 from miqrogroove/patch-1
authorHypolite Petovan <mrpetovan@gmail.com>
Tue, 19 Jun 2018 21:55:24 +0000 (17:55 -0400)
committerGitHub <noreply@github.com>
Tue, 19 Jun 2018 21:55:24 +0000 (17:55 -0400)
Add Missing Fifth Argument to mail() Function Call

doc/htconfig.md
src/Util/Emailer.php

index ada17e8ad25d93c990fd789fa481a6d3bfe8d2e8..15242e30775accea3f2a876e5fd62e2e7a7a1c6d 100644 (file)
@@ -85,6 +85,7 @@ Example: To set the automatic database cleanup process add this line to your .ht
 * **pushpoll_frequency** -
 * **qsearch_limit** - Default value is 100.
 * **remove_multiplicated_lines** (Boolean) - If enabled, multiple linefeeds in items are stripped to a single one.
+* **sendmail_params** (Boolean) - Normal sendmail command parameters will be added when the PHP mail() function is called for sending e-mails.  This ensures the Sender Email address setting is applied to the message envelope rather than the host's default address.  Default is true.  Set to false if your non-sendmail agent is incompatible, or to restore old behavior of using the host address.
 * **show_unsupported_addons** (Boolean) - Show all addons including the unsupported ones.
 * **show_unsupported_themes** (Boolean) - Show all themes including the unsupported ones.
 * **show_global_community_hint** (Boolean) - When the global community page is enabled, use this option to display a hint above the stream, that this is a collection of all public top-level postings that arrive on your node.
index 7d35e54417eb5452c3b52a39fb9dacde87e317b6..4fa5e290576df8c384377a9cb55d66c52f5f2a7e 100644 (file)
@@ -5,6 +5,7 @@
 namespace Friendica\Util;
 
 use Friendica\Core\Addon;
+use Friendica\Core\Config;
 use Friendica\Core\PConfig;
 use Friendica\Protocol\Email;
 
@@ -72,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 = [
                        '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);