Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

Hackfest UK 2014/Email Logging

From MoodleDocs

Message Logging and Reporting

  • Contact Names: (please add name if interested)
  • Larry Zoumas (larry(dot)zoumas@xtractor.se)
  • Martin Sandberg (martin(dot)sandberg@xtractor.se)
  • David Aylmer (david(d)aylmer(a)floream(d)com)
  • Rob Hardy (r(dot)hardy(at)yorksj(dot)ac(dot)uk)
  • Marcus Green (m(dot)green(at)yorksj(dot)ac(dot)uk)

Description

  • This plugin will allow admins and teachers to search through messages sent to users. The purpose is to easily answer the question of whether or not a user was notified of an important event, such as a face-to-face session, quiz deadline, etc.

Notes:

  • Not all emails go through the messaging system. This needs to be investigated and fixed.
  • We might want to allow a place for developers to add hooks or decorate this functionality.
  • We are not sure how this will work with email digests. We should probably log when the digest email goes out.

Email functions not using the messaging system

  • Self Enrolment Enrolment plugin (core)
  • moodle account being locked out after multiple invalid login attempts. (lockoutemailbody) (core)
  • When a badge has been awarded (core)
  • Emailing admins about failed login attempts (core)
  • To alert support email if log table can not be written into (core)
  • Welcome emails (core)
  • Password reset (core)
  • Confirmation email activation link (core)
  • Confirmation two (emailpasswordconfirmation) (core)
  • Password change is disabled email (core)
  • When using the email message output plugin (core)
  • When sending forum digests (forum cron - core)
  • Journal mod (journal cron -core)
  • When oublogs are moderated and require confirmation by the author (core)
  • If user changes email address confirmation is required (core)

NOTE: Many third party (moodle partner) add-ons will use direct calls to email_to_user. This function should be better encapsulated in regards to information hiding design principles.


Capabilities:

  • Can view own messages
  • Can view other messages
  • Can view messages in your courses (teacher)
  • Can view message body information

Options:

  • Optionally log body of message

Proposed Table Schema

messaging_log

  • id
  • from (user_id)
  • from_address (email address or identifier when the message was sent)
  • message_type (FK mdl_message_provider)
  • moduleid
  • courseid
  • subject
  • body_id
  • time

messaging_log_user

  • id
  • message_log_id (FK to messaging log)
  • userid
  • to_address (email address or identifier when the message was sent)
  • time
  • status

messaging_log_body

  • id
  • body_text
  • file_id (FK to mdl_files to see attachment size, etc)
  • email_headers (if any)
  • message_format (html or text)

ER diagram of tables

Reporting Output headings suggested order (left to right)

  • Message type
  • Course category (with link to category)
  • Course (with link to course)
  • Component/module (with link to mod e.g. forum post/discussion etc)
  • Peview body link (html/text)
  • Sender Fullname (link to profile)
  • Recipient Fullname (with link to profile)
  • Recipient email/jabberid/mobile phoine number/etc sent to
  • subject
  • time sent
  • status (success)

filters

  • Download as spreadsheet
  • Paging number of users
  • Filter by course
  • Filter by activity
  • Filter by user
  • Filter by message_type
  • Filter by sent datetime
  • Filter by subject

Tracker issue

Extend messaging system to log messages sent...