Elgg
Version 4.3
Main Page
Related Pages
Namespaces
Classes
Files
Examples
File List
File Members
engine
classes
Elgg
Notifications
SendEmailHandler.php
Go to the documentation of this file.
1
<?php
2
3
namespace
Elgg\Notifications
;
4
10
class
SendEmailHandler
{
11
19
public
function
__invoke
(\
Elgg
\
Hook
$hook) {
20
if
($hook->getValue() ===
true
) {
21
// assume someone else already sent the message
22
return
;
23
}
24
25
$message
= $hook->getParam(
'notification'
);
26
if
(!
$message
instanceof \
Elgg
\Notifications\
Notification
) {
27
return
false
;
28
}
29
30
$sender =
$message
->getSender();
31
if
(!$sender) {
32
return
false
;
33
}
34
35
$recipient
=
$message
->getRecipient();
36
if
(!
$recipient
|| !
$recipient
->email) {
37
return
false
;
38
}
39
40
$email
=
\Elgg\Email::factory
([
41
'from'
=> $sender,
42
'to'
=>
$recipient
,
43
'subject'
=>
$message
->subject,
44
'body'
=>
$message
->body,
45
'params'
=>
$message
->params,
46
]);
47
48
return
_elgg_services
()->emails->send(
$email
);
49
}
50
}
Elgg\Notifications\SendEmailHandler\__invoke
__invoke(\Elgg\Hook $hook)
Send an email notification.
Definition:
SendEmailHandler.php:19
$message
$message
Definition:
set_maintenance_mode.php:7
$email
$email
Definition:
change_email.php:7
Elgg\Email\factory
static factory(array $options=[])
Create an email instance form an array of options.
Definition:
Email.php:80
Elgg\Notifications\Notification
Notification container.
Definition:
Notification.php:10
Elgg\Notifications\SendEmailHandler
Sends email.
Definition:
SendEmailHandler.php:10
Elgg\Hook
Models an event passed to hook handlers.
Definition:
Hook.php:11
Elgg
Definition:
ActionsService.php:3
Elgg\Notifications
Definition:
CreateCommentEventHandler.php:3
_elgg_services
_elgg_services()
Get the global service provider.
Definition:
elgglib.php:638
$recipient
$recipient
Definition:
mute.php:8
Generated on Sat Feb 4 2023 00:00:23 for Elgg by
1.8.11