Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'MDL-31335_mtrace_email_21' of git://github.com/andyjdav…

…is/moodle into MOODLE_21_STABLE
  • Loading branch information...
commit 8b1876f3b554255c66cf8b394814ca5b6ad3812d 2 parents 4c52d60 + f684c55
@nebgor nebgor authored
Showing with 23 additions and 8 deletions.
  1. +23 −8 lib/moodlelib.php
View
31 lib/moodlelib.php
@@ -4610,19 +4610,31 @@ function email_to_user($user, $from, $subject, $messagetext, $messagehtml='', $a
global $CFG, $FULLME;
if (empty($user) || empty($user->email)) {
- mtrace('Error: lib/moodlelib.php email_to_user(): User is null or has no email');
+ $nulluser = 'User is null or has no email';
+ error_log($nulluser);
+ if (CLI_SCRIPT) {
+ mtrace('Error: lib/moodlelib.php email_to_user(): '.$nulluser);
+ }
return false;
}
if (!empty($user->deleted)) {
- // do not mail delted users
- mtrace('Error: lib/moodlelib.php email_to_user(): User is deleted');
+ // do not mail deleted users
+ $userdeleted = 'User is deleted';
+ error_log($userdeleted);
+ if (CLI_SCRIPT) {
+ mtrace('Error: lib/moodlelib.php email_to_user(): '.$userdeleted);
+ }
return false;
}
if (!empty($CFG->noemailever)) {
// hidden setting for development sites, set in config.php if needed
- mtrace('Error: lib/moodlelib.php email_to_user(): Not sending email due to noemailever config setting');
+ $noemail = 'Not sending email due to noemailever config setting';
+ error_log($noemail);
+ if (CLI_SCRIPT) {
+ mtrace('Error: lib/moodlelib.php email_to_user(): '.$noemail);
+ }
return true;
}
@@ -4642,8 +4654,7 @@ function email_to_user($user, $from, $subject, $messagetext, $messagehtml='', $a
$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);
+ mtrace('Error: lib/moodlelib.php email_to_user(): '.$invalidemail);
}
return false;
}
@@ -4651,7 +4662,9 @@ function email_to_user($user, $from, $subject, $messagetext, $messagehtml='', $a
if (over_bounce_threshold($user)) {
$bouncemsg = "User $user->id (".fullname($user).") is over bounce threshold! Not sending.";
error_log($bouncemsg);
- mtrace('Error: lib/moodlelib.php email_to_user(): '.$bouncemsg);
+ if (CLI_SCRIPT) {
+ mtrace('Error: lib/moodlelib.php email_to_user(): '.$bouncemsg);
+ }
return false;
}
@@ -4795,8 +4808,10 @@ function email_to_user($user, $from, $subject, $messagetext, $messagehtml='', $a
}
return true;
} else {
- mtrace('ERROR: '. $mail->ErrorInfo);
add_to_log(SITEID, 'library', 'mailer', $FULLME, 'ERROR: '. $mail->ErrorInfo);
+ if (CLI_SCRIPT) {
+ mtrace('Error: lib/moodlelib.php email_to_user(): '.$mail->ErrorInfo);
+ }
if (!empty($mail->SMTPDebug)) {
echo '</pre>';
}
Please sign in to comment.
Something went wrong with that request. Please try again.