Quiz submission email notification
Note: You are currently viewing documentation for Moodle 1.9. Up-to-date documentation for the latest stable version is available here: Quiz submission email notification.
When a student clicks 'Submit all and finish' to end a quiz attempt, it is possible to configure Quiz to send email notifications. There are two types of notification: a confirmation to the student that their attempt has finished successfully, and a notification to the teacher(s) that someone has submitted an attempt. Emails are never sent for preview attempts.
Allow confirmation emails to students
Email functions in a default Moodle Quiz are turned off for both students and teachers.
In the quiz settings or "Update this quiz" link, email options are turned on under the override permissions tab. Modify the student role and change the "Get email confirmation when submitting" (mod/quiz:emailconfirmsubmission) to "Allow".
Similarly, you can override the role at the course level to turn on notification for all quizzes in that course. The site administrator can also modify the student role for the entire site by allowing the mod/quiz:emailconfirmsubmission capability.
Allow notification emails to teachers
To turn on the email process for a teacher, the procedure is similar to the above. On the Override permission tab in Quiz settings, change the capability "Get email notification of submissions" (mod/quiz:emailnotifysubmission) to "Allow". This capability can also be turned on at the course level.
The site administrator can modify the teacher role for the entire site by changing the permission on mod/quiz:emailnotifysubmission to the allow permission.
Note that if the quiz is set to separate groups, then teachers will only get a notification if either
- the student is in the same group as the teacher, or
- the teacher has moodle/site:accessallgroups.
How to configure the text of the emails
The subject and body of the emails are defined in the quiz.php language file. The strings are 'emailconfirmsubject', 'emailconfirmbody', 'emailnotifysubject' and 'emailnotifybody'. The $a string passed in when these language strings are loaded contains all the following information:
- The name of the course
- The shortname of the course
- The name of the quiz
- The URL of the results overview for this quiz (.../mod/quiz/report.php?q=quizid)
- The URL of the results overview URL and quiz name as a HTML link
- The URL of the review page for this attempt (.../mod/quiz/review.php?attempt=attemptid)
- The attempt review URL and quiz name as a HTML link
- The URL of the main page of the quiz (.../mod/quiz/view.php?q=quizid)
- The URL of the quiz and the quiz name as a HTML link
- The time the attempt was submitted, formatted using userdate().
- How long the quiz attempt lasted.
- The name of the person who submitted the quiz.
- The idnumber of the person who submitted the quiz.
- The username of the person who submitted the quiz.
- The name of the user the email is being sent to.
- The idnumber of the user the email is being sent to.
- The username of the user the email is being sent to.