Troubleshoot

Has the user enabled email notifications?

As described above, many emails Moodle sends are sent indirectly as notifications. Although we attempt to hide this page from learners they're able to navigate to it directly and change their preferences. Whilst logged in as the user, navigate to /message/notificationpreferences.php and make sure the email output for the desired notification is enabled.

If a large volume of users seems to be affected it may be worth checking the default notification preferences too.

Did the user check their spam?

Self explanatory: we send a large volume of email with very low interaction volumes. Ensure that the user has checked their spam.

Is their email address correct?

Is the user receiving notifications from other systems? Is their email address on-platform correct?

Which server should send the email?

The majority of emails Moodle sends are sent from scheduled and ad hoc tasks.

Is the cron running?

If the email is sent from a task, check that the cron service is running and that the platform's cron is enabled.

Is a task failing to run?

If you see an error along the lines of Lock timeout, did not obtain * lock try removing it.

Is the MTA running?

Check that the MTA (likely postfix) service is running. We would expect to see it in the active (exited) state, as below:

$ sudo systemctl status postfix.service
● postfix.service - Postfix Mail Transport Agent
   Loaded: loaded (/lib/systemd/system/postfix.service; enabled; vendor preset: enabled)
   Active: active (exited) since Mon 2019-09-09 14:36:18 UTC; 23h ago
  Process: 5854 ExecStart=/bin/true (code=exited, status=0/SUCCESS)
 Main PID: 5854 (code=exited, status=0/SUCCESS)

Is the configuration correct?

In production environments, the following options must not be set:

  • (bool) $CFG->noemailever determines whether emails are sent at all. If enabled a warning will be raised and emails will not be delivered.
  • (string) $CFG->divertallemailsto diverts all emails to the specified email address regardless of the intended destination.

Ensure that $CFG->smtphosts points to the mail server (probably "127.0.0.1", the local MTA on the default port).