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

Balancing email sending

    XMLWordPrintable

Details

    • Improvement
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 3.8.5, 3.9.2
    • None
    • Administration, Email
    • None
    • MOODLE_38_STABLE, MOODLE_39_STABLE

    Description

      Today we have a platform with a considerable number of users and this in turn triggers a large number of emails.Today we have a platform with a considerable number of users and this in turn triggers a large number of emails.

      Our smtphosts configuration is server1.example.com; server2.example.com; server3.example.com

      With that, this data is sent to PHPMailer and this in turn explodes (";", $hosts) and tries to connect to them in order, this is intended to tolerate failures on a server.

      As we have no connection problems 100% of e-mails are sent by the first server.

      I believe that we could make a modification in the moodle, so that the behavior, besides tolerating failures, would assume send balance.

      ./lib/moodlelib.php in function get_mailer

      change
      // Specify main and backup servers.
      $mailer->Host = $CFG->smtphosts;

      to
      static $shakesmtphosts = false;
      if (!$shakesmtphosts){    $CFG->smtphosts = explode(';', $CFG->smtphosts);    shuffle($CFG->smtphosts);    $CFG->smtphosts = implode(';', $CFG->smtphosts);    $shakesmtphosts = true; }

      $mailer->Host = $CFG->smtphosts;

      I know that the comment talks about main and backup servers, so who knows to maintain this behavior, this new option to "shake" the servers could be a new configuration parameter.

      I also know that this could be suggested for PHPMailer, but then we would still depend on the moodle team to upgrade to the new version

      Attachments

        Activity

          People

            Unassigned Unassigned
            bernardo Bernardo Silva
            Andrew Lyons, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze, Stevani Andolo, Andrew Lyons, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze, Stevani Andolo
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: