X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FUtil%2FEmailer.php;h=6a19e8e4587c929b80c0cf1895f187ad5383f033;hb=eef85584c20121ed01b64401ac51ed279d19db8b;hp=1dd513c42fe3f1c10b19b390508ff60edec95858;hpb=a6996601d5260e4dde621f4d04b35adbbc3c10e0;p=friendica.git diff --git a/src/Util/Emailer.php b/src/Util/Emailer.php index 1dd513c42f..6a19e8e458 100644 --- a/src/Util/Emailer.php +++ b/src/Util/Emailer.php @@ -4,8 +4,9 @@ */ namespace Friendica\Util; -use Friendica\Core\Addon; use Friendica\Core\Config; +use Friendica\Core\Hook; +use Friendica\Core\Logger; use Friendica\Core\PConfig; use Friendica\Protocol\Email; @@ -18,24 +19,25 @@ 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) { - Addon::callHooks('emailer_send_prepare', $params); + Hook::callAll('emailer_send_prepare', $params); $email_textonly = false; - if (x($params, "uid")) { + if (!empty($params['uid'])) { $email_textonly = PConfig::get($params['uid'], "system", "email_textonly"); } @@ -87,8 +89,9 @@ class Emailer 'headers' => $messageHeader, 'parameters' => $sendmail_params ]; - //echo "
"; var_dump($hookdata); killme();
-		Addon::callHooks("emailer_send", $hookdata);
+
+		Hook::callAll("emailer_send", $hookdata);
+
 		$res = mail(
 			$hookdata['to'],
 			$hookdata['subject'],
@@ -96,8 +99,8 @@ class Emailer
 			$hookdata['headers'],
 			$hookdata['parameters']
 		);
-		logger("header " . 'To: ' . $params['toEmail'] . "\n" . $messageHeader, LOGGER_DEBUG);
-		logger("return value " . (($res)?"true":"false"), LOGGER_DEBUG);
+		Logger::log("header " . 'To: ' . $params['toEmail'] . "\n" . $messageHeader, Logger::DEBUG);
+		Logger::log("return value " . (($res)?"true":"false"), Logger::DEBUG);
 		return $res;
 	}
 }