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

Log outgoing mail

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 2.9.1, 3.0.2
    • Fix Version/s: None
    • Component/s: Logging
    • Testing Instructions:
      Hide
      1. Send an email (e.g. via a forum, with "Mail now")
      2. View Site administration ► Reports ► Logs, filtered by:
        • Site logs
        • action=Create
        • edulevel=Other
      3. Confirm that there is an "Email sent" event, with the "to" address, "from" address, and subject line used for the email.
      Show
      Send an email (e.g. via a forum, with "Mail now") View Site administration ► Reports ► Logs, filtered by: Site logs action=Create edulevel=Other Confirm that there is an "Email sent" event, with the "to" address, "from" address, and subject line used for the email.
    • Affected Branches:
      MOODLE_29_STABLE, MOODLE_30_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-51386-master

      Description

      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():

      1. 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).
      2. 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.
      3. 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?

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                14 Vote for this issue
                Watchers:
                16 Start watching this issue

                Dates

                • Created:
                  Updated: