Moodle System Message Troubles?

Moodle System Message Troubles?

by Troy May -
Number of replies: 0

I have had much trouble in the past attempting to implement system messages such as when a student needs to reset their password or confirm their new accounts.

The fact is only by setting the Server > Support contact > Support email to an email address having the @yoursitesbaseurl.com for its suffix, will it work. And this email address doesn't even have to be a real one. It simply needs to have the exact same address after the "@" as your website's url.

In my experience, setting this to anything else totally disables the Moodle system from sending system messages to students.

Furthermore, what if, after you manage to get it working, you want to monitor every email sent by your system? Where is the Moodle setting for this? How can Moodle send your system admin a copy of every email sent by the system? Shockingly, there isn't a Moodle setting for it. You have to hack one into it. Here is how:

In your config.php, add this line after

$CFG->bccmails='somename@someaddress.com';
If you need a second CC, add this:
$CFG->bccmails2='someothername@someotheraddress.com';

Also, you must edit a part of the Moodle base code. In the lib/moodlelib.php of your base server directory, locate this line:

 if ($mail->Send()) {

Then add the follow just ABOVE the "if ($mail->Send()) {"

if (!empty($CFG->bccmails)){
   $mail->AddBCC($CFG->bccmails);
    }
if (!empty($CFG->bccmails2)){
    $mail->AddBCC($CFG->bccmails2);
}

This will give you ability to add two unique CC addresses to send all system emails to. if you want a third, you can see how the code differs. Simply duplicate the code again and change the "bccmails2" to a subsequent number.

I hope this hopes someone.

I know there are SMTP setting options built into Moodle. Unfortunately for me, I have NEVER gotten any of that to work. Only the above settings work for my system.

Average of ratings: -