- Send an email (e.g. via a forum, with "Mail now")
- View Site administration ► Reports ► Logs, filtered by:
- Site logs
- Confirm that there is an "Email sent" event, with the "to" address, "from" address, and subject line used for the email.
For student and staff support, it is sometimes useful to have a log of emails successfully sent out (at least, handed off to the smtp server without an error).
E.g. If a student complains they weren't notified of the assignment being graded, the log can be reviewed to see if the email was sent.
There are three approaches to logging that I can think of, all modifying email_to_user():
- Add a new \core\event\email_sent event, to complement \core\event\email_failed in lib/moodlelib.php
- Seems like the best use of the Moodle APIs.
- However, built-in reporting tools don't seem easy to query.
- Would probably be coded to only record the metadata (from/to/subject/date).
- BCC all sent emails to an admin email account, via a setting like $CFG->bccmails
- Creates an archive of the entire email, including the body - which could be good or bad, depending on one's requirements.
- Requires an email account suitable for high-volume traffic.
- Log all sent emails to a log file on the server (my current hack).
- Not accessible from Moodle interface.
- Easy to grep if one has CLI access.
Is this worth including? Which approach would be best?