-
Improvement
-
Resolution: Deferred
-
Minor
-
None
-
3.8.5, 3.9.2
-
None
-
MOODLE_38_STABLE, MOODLE_39_STABLE
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