mirror of
https://github.com/moodle/moodle.git
synced 2025-08-08 10:26:40 +02:00
MDL-40051 core_lib: replaced add_to_log call when failing to send email with an event
This commit is contained in:
parent
0b7422f366
commit
362b9a0465
4 changed files with 126 additions and 1 deletions
|
@ -5830,7 +5830,18 @@ function email_to_user($user, $from, $subject, $messagetext, $messagehtml = '',
|
|||
}
|
||||
return true;
|
||||
} else {
|
||||
add_to_log(SITEID, 'library', 'mailer', qualified_me(), 'ERROR: '. $mail->ErrorInfo);
|
||||
// Trigger event for failing to send email.
|
||||
$event = \core\event\email_failed::create(array(
|
||||
'context' => context_system::instance(),
|
||||
'userid' => $from->id,
|
||||
'relateduserid' => $user->id,
|
||||
'other' => array(
|
||||
'subject' => $subject,
|
||||
'message' => $messagetext,
|
||||
'errorinfo' => $mail->ErrorInfo
|
||||
)
|
||||
));
|
||||
$event->trigger();
|
||||
if (CLI_SCRIPT) {
|
||||
mtrace('Error: lib/moodlelib.php email_to_user(): '.$mail->ErrorInfo);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue