mirror of
https://github.com/moodle/moodle.git
synced 2025-03-19 23:20:09 +01:00
Merge branch 'MDL-48080_master' of https://github.com/crazyserver/moodle
This commit is contained in:
commit
0d3e8ed4f6
@ -5800,23 +5800,22 @@ function email_to_user($user, $from, $subject, $messagetext, $messagehtml = '',
|
||||
|
||||
if (!validate_email($user->email)) {
|
||||
// We can not send emails to invalid addresses - it might create security issue or confuse the mailer.
|
||||
$invalidemail = "User $user->id (".fullname($user).") email ($user->email) is invalid! Not sending.";
|
||||
error_log($invalidemail);
|
||||
if (CLI_SCRIPT) {
|
||||
mtrace('Error: lib/moodlelib.php email_to_user(): '.$invalidemail);
|
||||
}
|
||||
debugging("email_to_user: User $user->id (".fullname($user).") email ($user->email) is invalid! Not sending.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (over_bounce_threshold($user)) {
|
||||
$bouncemsg = "User $user->id (".fullname($user).") is over bounce threshold! Not sending.";
|
||||
error_log($bouncemsg);
|
||||
if (CLI_SCRIPT) {
|
||||
mtrace('Error: lib/moodlelib.php email_to_user(): '.$bouncemsg);
|
||||
}
|
||||
debugging("email_to_user: User $user->id (".fullname($user).") is over bounce threshold! Not sending.");
|
||||
return false;
|
||||
}
|
||||
|
||||
// TLD .invalid is specifically reserved for invalid domain names.
|
||||
// For More information, see {@link http://tools.ietf.org/html/rfc2606#section-2}.
|
||||
if (substr($user->email, -8) == '.invalid') {
|
||||
debugging("email_to_user: User $user->id (".fullname($user).") email domain ($user->email) is invalid! Not sending.");
|
||||
return true; // This is not an error.
|
||||
}
|
||||
|
||||
// If the user is a remote mnet user, parse the email text for URL to the
|
||||
// wwwroot and modify the url to direct the user's browser to login at their
|
||||
// home site (identity provider - idp) before hitting the link itself.
|
||||
|
Loading…
x
Reference in New Issue
Block a user