Enable addon using emailer hooks to skip default call to mail()

This commit is contained in:
Hypolite Petovan 2019-05-25 23:45:10 -04:00
parent f225752f8a
commit 4e207ef786
2 changed files with 15 additions and 2 deletions

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'],