mirror of
https://github.com/friendica/friendica
synced 2025-04-25 23:50:11 +00:00
Adds 'emailer_send_prepare' and 'emailer_send' hooks
Adds relative documentation in doc/Plugins
This commit is contained in:
parent
c3ec68a520
commit
a659b34117
2 changed files with 31 additions and 4 deletions
|
@ -17,6 +17,8 @@ class Emailer {
|
|||
*/
|
||||
static public function send($params) {
|
||||
|
||||
call_hooks('emailer_send_prepare', $params);
|
||||
|
||||
$fromName = email_header_encode(html_entity_decode($params['fromName'],ENT_QUOTES,'UTF-8'),'UTF-8');
|
||||
$messageSubject = email_header_encode(html_entity_decode($params['messageSubject'],ENT_QUOTES,'UTF-8'),'UTF-8');
|
||||
|
||||
|
@ -49,11 +51,18 @@ class Emailer {
|
|||
"--" . $mimeBoundary . "--\n"; // message ending
|
||||
|
||||
// send the message
|
||||
$hookdata = array(
|
||||
'to' => $params['toEmail'],
|
||||
'subject' => $messageSubject,
|
||||
'body' => $multipartMessageBody,
|
||||
'headers' => $messageHeader
|
||||
);
|
||||
call_hooks("emailer_send", $hookdata);
|
||||
$res = mail(
|
||||
$params['toEmail'], // send to address
|
||||
$messageSubject, // subject
|
||||
$multipartMessageBody, // message body
|
||||
$messageHeader // message headers
|
||||
$hookdata['to'], // send to address
|
||||
$hookdata['subject'], // subject
|
||||
$hookdata['body'], // message body
|
||||
$hookdata['headers'], // message headers
|
||||
);
|
||||
logger("header " . 'To: ' . $params['toEmail'] . "\n" . $messageHeader, LOGGER_DEBUG);
|
||||
logger("return value " . (($res)?"true":"false"), LOGGER_DEBUG);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue