Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-51727

Enable SMTP debugging without displaying debug messages to end users

    XMLWordPrintable

Details

    • Improvement
    • Status: Development in progress
    • Minor
    • Resolution: Unresolved
    • 2.7.10, 2.8.8, 2.9.2, 3.0
    • None
    • General, Libraries

    Description

      Currently, if you want to debug smtp mail sending, you need to enable the debugsmtp setting.

      However, this simply makes phpmailer echo it's debug messages.

      To actually be able to read those error messages, you need to enable "display debug messages" and set the "debug messages" setting to NORMAL or higher, so that the page does not immediately redirect after the messages are shown.

      Now, ideally, we should be able to log those messages someplace instead of seeing them on the screen. For example when a problem is seen on a production server, that can not be reproduced on a test server. phpmailer has a "Debugoutput" variable, which allows specifying what happens with it's debug messages. The default value is "echo". However, it can also be set to "error_log", in which case it will use php's error log function.

      Shouldn't Moodle expose this functionality? I'd imagine it working like this:

      if ($CFG->debugsmtp) {
        if (empty($CFG->debugdisplay)) {
          $mailer->Debugoutput = "error_log";
        }
      }
      

      Attachments

        Issue Links

          Activity

            People

              nadavkav Nadav Kavalerchik
              brianking Brian King
              Votes:
              4 Vote for this issue
              Watchers:
              10 Start watching this issue

              Dates

                Created:
                Updated: