Elgg
Version 6.1
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
\
Event
$event) {
20
if
($event->getValue() ===
true
) {
21
// assume someone else already sent the message
22
return
;
23
}
24
25
$message
= $event->getParam(
'notification'
);
26
if
(!
$message
instanceof \
Elgg
\Notifications\
Notification
) {
27
return
false
;
28
}
29
30
$sender =
$message
->getSender();
31
$recipient
=
$message
->getRecipient();
32
if
(!
$recipient
->email) {
33
return
false
;
34
}
35
36
$email
=
\Elgg\Email::factory
([
37
'from'
=> $sender,
38
'to'
=>
$recipient
,
39
'subject'
=>
$message
->subject,
40
'body'
=>
$message
->body,
41
'params'
=>
$message
->params,
42
]);
43
44
return
_elgg_services
()->emails->send(
$email
);
45
}
46
}
$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:11
Elgg\Notifications\SendEmailHandler
Sends email.
Definition:
SendEmailHandler.php:10
Elgg\Notifications\SendEmailHandler\__invoke
__invoke(\Elgg\Event $event)
Send an email notification.
Definition:
SendEmailHandler.php:19
Elgg
Definition:
ActionsService.php:3
Elgg\Notifications
Definition:
CreateCommentEventHandler.php:3
_elgg_services
_elgg_services()
Get the global service provider.
Definition:
elgglib.php:353
$recipient
$recipient
Definition:
mute.php:8
Elgg\Event
Models an event passed to event handlers.
Definition:
Event.php:11
Generated on Wed Dec 4 2024 00:00:21 for Elgg by
1.8.11