Merge pull request #7187 from MrPetovan/bug/7023-emailer-hooks

Enable addon using emailer hooks to skip default call to mail()
This commit is contained in:
Philipp
2019-05-28 08:02:48 +02:00
committed by GitHub
2 changed files with 15 additions and 2 deletions
+13 -2
View File
@@ -32,10 +32,16 @@ class Emailer
* @return bool
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function send($params)
public static function send(array $params)
{
$params['sent'] = false;
Hook::callAll('emailer_send_prepare', $params);
if ($params['sent']) {
return true;
}
$email_textonly = false;
if (!empty($params['uid'])) {
$email_textonly = PConfig::get($params['uid'], "system", "email_textonly");
@@ -87,11 +93,16 @@ class Emailer
'subject' => $messageSubject,
'body' => $multipartMessageBody,
'headers' => $messageHeader,
'parameters' => $sendmail_params
'parameters' => $sendmail_params,
'sent' => false,
];
Hook::callAll("emailer_send", $hookdata);
if ($hookdata['sent']) {
return true;
}
$res = mail(
$hookdata['to'],
$hookdata['subject'],