From 5b8619f501697b95386cd54b0632bd787952fb41 Mon Sep 17 00:00:00 2001 From: miqrogroove Date: Tue, 19 Jun 2018 16:23:42 -0400 Subject: [PATCH] Add Missing Fifth Argument to mail() Function Call 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 | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/Util/Emailer.php b/src/Util/Emailer.php index 7d35e5441..c58c234df 100644 --- a/src/Util/Emailer.php +++ b/src/Util/Emailer.php @@ -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 "
"; 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);