Moodle
  1. Moodle
  2. MDL-37152

SMTP mailer is set, even though configured not to use SMTP

    Details

    • Testing Instructions:
      Hide

      0/ configure moodle to use SMTP server for mail sending and smtpmaxbulk > 1
      1/ trigger some action that mails multiple emails via SMTP (such as forum mailing to multiple users). Verify mails are sent.
      2/ repeat with other non-smtp mail type (hint: set smtp hosts to 'qmail' or leave empty for sendmail). Verify no "SMTP Error: Could not connect to SMTP host" is logged / shown and mails are sent.

      Show
      0/ configure moodle to use SMTP server for mail sending and smtpmaxbulk > 1 1/ trigger some action that mails multiple emails via SMTP (such as forum mailing to multiple users). Verify mails are sent. 2/ repeat with other non-smtp mail type (hint: set smtp hosts to 'qmail' or leave empty for sendmail). Verify no "SMTP Error: Could not connect to SMTP host" is logged / shown and mails are sent.
    • Affected Branches:
      MOODLE_22_STABLE, MOODLE_23_STABLE, MOODLE_24_STABLE, MOODLE_25_STABLE
    • Fixed Branches:
      MOODLE_22_STABLE, MOODLE_23_STABLE, MOODLE_24_STABLE
    • Pull from Repository:
    • Pull 2.4 Branch:
      w51_MDL-37152_m24_smtp
    • Pull Master Branch:
      w51_MDL-37152_m25_smtp
    • Rank:
      46724

      Description

      We are experiencing the same issue as described in this bug report: http://tracker.moodle.org/browse/MDL-29494

      Users are getting this error message: "SMTP Error: Could not connect to SMTP host", although our configuration uses default PHP mail function (smtphosts is empty).

      Looking at the source I found that $mail->IsSMTP() is being called in email_to_user function after a message is successfully sent (lib/moodlelib.php line 5469 in MOODLE_23_STABLE, 5505 in MOODLE_24_STABLE).

      A quick workaround is to set smtpmaxbulk to 1 - so that the same incorrectly reconfigured mailer is not reused for next messages.

        Activity

        Hide
        Rajesh Taneja added a comment -

        Thanks for reporting this Aurelijus,

        I tried instructions from MDL-29494, but can't reproduce this problem.
        Can you please provide replication steps.

        Show
        Rajesh Taneja added a comment - Thanks for reporting this Aurelijus, I tried instructions from MDL-29494 , but can't reproduce this problem. Can you please provide replication steps.
        Hide
        Aurelijus Bruzas added a comment -

        Hi,

        the error messages appear when users are submitting assignments. It looks like these messages are harmless, because notification emails are still sent.

        To reproduce it, configure moodle to use standard php mail function, set smtpmaxbulk to value greater that 1, and try to submit an assignment in a course with several graders (there has to be more than one user that gets the notification).

        Show
        Aurelijus Bruzas added a comment - Hi, the error messages appear when users are submitting assignments. It looks like these messages are harmless, because notification emails are still sent. To reproduce it, configure moodle to use standard php mail function, set smtpmaxbulk to value greater that 1, and try to submit an assignment in a course with several graders (there has to be more than one user that gets the notification).
        Hide
        Rajesh Taneja added a comment -

        Thanks Aurelijus,

        I can put this on backlog and we will try to get this resolved soon.

        In the mean time feel free to help us with solution on this.

        Steps to reproduce:

        1. As an admin set smtphosts = empty.
        2. Set smtpmaxbulk = 2
        3. Create assignment
        4. Enrol 2 teachers
        5. As student submit assignment
        6. You should see error message
        Show
        Rajesh Taneja added a comment - Thanks Aurelijus, I can put this on backlog and we will try to get this resolved soon. In the mean time feel free to help us with solution on this. Steps to reproduce: As an admin set smtphosts = empty. Set smtpmaxbulk = 2 Create assignment Enrol 2 teachers As student submit assignment You should see error message
        Hide
        Aurelijus Bruzas added a comment -

        Removing the line with $mail->IsSMTP() (mentioned in this bug report) should fix this problem. I'm not sure about the purpose of this line - it doesn't appear to be doing anything meaningful, or maybe I just can't see the reason why it's there.

        Show
        Aurelijus Bruzas added a comment - Removing the line with $mail->IsSMTP() (mentioned in this bug report) should fix this problem. I'm not sure about the purpose of this line - it doesn't appear to be doing anything meaningful, or maybe I just can't see the reason why it's there.
        Hide
        Petr Škoda added a comment -

        Thanks a lot, I agree the line is bogus.

        Show
        Petr Škoda added a comment - Thanks a lot, I agree the line is bogus.
        Hide
        Eloy Lafuente (stronk7) added a comment -

        Sorry, reopening because of bogus testing instructions.

        Show
        Eloy Lafuente (stronk7) added a comment - Sorry, reopening because of bogus testing instructions.
        Hide
        Eloy Lafuente (stronk7) added a comment -

        Integrated (22, 23, 24 & master), thanks!

        Show
        Eloy Lafuente (stronk7) added a comment - Integrated (22, 23, 24 & master), thanks!
        Hide
        Rossiani Wijaya added a comment -

        This is working as expected.

        Test passed.

        Show
        Rossiani Wijaya added a comment - This is working as expected. Test passed.
        Hide
        Eloy Lafuente (stronk7) added a comment -

        And your fantastic code has met core, hope they become good friends for a long period.

        Closing, thanks!

        Show
        Eloy Lafuente (stronk7) added a comment - And your fantastic code has met core, hope they become good friends for a long period. Closing, thanks!

          People

          • Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: