]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-8834 smtp debugging can now be turned off - now independent on $CFG->debug; merge...
authorskodak <skodak>
Fri, 9 Mar 2007 20:16:48 +0000 (20:16 +0000)
committerskodak <skodak>
Fri, 9 Mar 2007 20:16:48 +0000 (20:16 +0000)
admin/settings/server.php
lang/en_utf8/admin.php
lib/moodlelib.php

index 30e1b701c31a5f0a24cc94758efa5406c5c98ca4..30d04ac915dba10c944d7e5d7004eb172737ad28 100644 (file)
@@ -85,6 +85,7 @@ $ADMIN->add('server', $temp);
 $temp = new admin_settingpage('debugging', get_string('debugging', 'admin'));
 $temp->add(new admin_setting_special_debug());
 $temp->add(new admin_setting_special_debugdisplay());
+$temp->add(new admin_setting_configcheckbox('debugsmtp', get_string('debugsmtp', 'admin'), get_string('configdebugsmtp', 'admin'), 0));
 $temp->add(new admin_setting_special_perfdebug());
 $ADMIN->add('server', $temp);
 
index 4abbe1b6566fd59a620fdf81de6e45c315b4b73a..45c4774d12fa35013123a61683d8ad674517ec17 100644 (file)
@@ -69,6 +69,7 @@ $string['configcoursesperpage'] = 'Enter the number of courses to be display per
 $string['configdbsessions'] = 'If enabled, this setting will use the database to store information about current sessions.  This is especially useful for large/busy sites or sites built on cluster of servers.  For most sites this should probably be left disabled so that the server disk is used instead.  Note that changing this setting now will log out all current users (including you). If you are using MySQL please make sure that \'max_allowed_packet\' in my.cnf (or my.ini) is at least 4M.';
 $string['configdebug'] = 'If you turn this on, then PHP\'s error_reporting will be increased so that more warnings are printed.  This is only useful for developers.';
 $string['configdebugdisplay'] = 'Set to on, the error reporting will go to the HTML page. This is practical, but breaks XHTML, JS, cookies and HTTP headers in general. Set to off, it will send the output to your server logs, allowing better debugging. The PHP setting error_log controls which log this goes to.';
+$string['configdebugsmtp'] = 'Enable verbose debug information during sending of email messages to SMTP server.';
 $string['configdefaultallowedmodules'] = 'For the courses which fall into the above category, which modules do you want to allow by default <b>when the course is created</b>?';
 $string['configdefaultcourseroleid'] = 'Users who enrol in a course will be automatically assigned this role.';
 $string['configdefaultrequestcategory'] = 'Courses requested by users will be automatically placed in this category.';
@@ -221,6 +222,7 @@ $string['dbmigrationdupfailed'] = 'Database duplication failed with possible err
 $string['dbsessions'] = 'Use database for session information';
 $string['debug'] = 'Debug messages';
 $string['debugdisplay'] = 'Display debug messages';
+$string['debugsmtp'] = 'Debug email sending';
 $string['debugall'] = 'ALL: Show all reasonable PHP debug messages';
 $string['debugdeveloper'] = 'DEVELOPER: extra Moodle debug messages for developers';
 $string['debugging'] = 'Debugging';
index b6009b1fbe5bf5109af9f107ba55e3f6d45c316b..66d2d2955c84c58fd45a30fa167c21081fbf3974 100644 (file)
@@ -3306,7 +3306,7 @@ function email_to_user($user, $from, $subject, $messagetext, $messagehtml='', $a
 
     } else {
         $mail->IsSMTP();                               // use SMTP directly
-        if (debugging()) {
+        if (!empty($CFG->debugsmtp)) {
             echo '<pre>' . "\n";
             $mail->SMTPDebug = true;
         }
@@ -3426,10 +3426,17 @@ function email_to_user($user, $from, $subject, $messagetext, $messagehtml='', $a
 
     if ($mail->Send()) {
         set_send_count($user);
+        $mail->IsSMTP();                               // use SMTP directly
+        if (!empty($CFG->debugsmtp)) {
+            echo '</pre>';
+        }
         return true;
     } else {
         mtrace('ERROR: '. $mail->ErrorInfo);
         add_to_log(SITEID, 'library', 'mailer', $FULLME, 'ERROR: '. $mail->ErrorInfo);
+        if (!empty($CFG->debugsmtp)) {
+            echo '</pre>';
+        }
         return false;
     }
 }