diff --git a/lib/datalib.php b/lib/datalib.php index 15363503d0d..b4598e201ad 100644 --- a/lib/datalib.php +++ b/lib/datalib.php @@ -1890,7 +1890,9 @@ function add_to_log($courseid, $module, $action, $url='', $info='', $cm=0, $user // email_to_user is not usable because email_to_user tries to write to the logs table, and this will get caught // in an infinite loop, if disk is full - mail($CFG->supportemail, $subject, $message); + if (empty($CFG->noemailever)) { + mail($CFG->supportemail, $subject, $message); + } } if (!$result and debugging()) { diff --git a/lib/setup.php b/lib/setup.php index 1dbc9f90ea4..6b0a2c8d022 100644 --- a/lib/setup.php +++ b/lib/setup.php @@ -155,7 +155,7 @@ global $HTTPSPAGEREQUIRED; echo ''; echo ''; - if (!empty($CFG->emailconnectionerrorsto)) { + if (empty($CFG->noemailever) and !empty($CFG->emailconnectionerrorsto)) { mail($CFG->emailconnectionerrorsto, 'WARNING: Database connection error: '.$CFG->wwwroot, 'Connection error: '.$CFG->wwwroot);