Merge branch 'w04_MDL-31202_m23_emailvalidation' of git://github.com/skodak/moodle

This commit is contained in:
Sam Hemelryk 2012-01-23 14:23:25 +08:00
commit e24baafefc

View File

@ -5028,6 +5028,17 @@ function email_to_user($user, $from, $subject, $messagetext, $messagehtml='', $a
return true;
}
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) {
// do not print this in standard web pages
mtrace($invalidemail);
}
return false;
}
if (over_bounce_threshold($user)) {
$bouncemsg = "User $user->id (".fullname($user).") is over bounce threshold! Not sending.";
error_log($bouncemsg);