I would like to send emails only to users that have completed a specific course and add a pdf file (a certificate for completing the course) as attachment to the email, and do so at a specific time using moodle cron.
I have looked at some plugins to find out how it's done, but I'm still not sure how exactly I should do this.
I need:
1. to know how I would add an attachment to an email (and which API to use),
2. how I would use cron to send the emails to the desired group at a certain time,
3. how to retrieve users that have completed the course so that I could send emails (with attachment) to them.
Thanks in advance.
(I'm using moodle version 3.0)
This is an overview.
/local/yourplugin
https://docs.moodle.org/dev/Local_plugins
https://docs.moodle.org/dev/Message_API
defined('MOODLE_INTERNAL') || die();
in
local/yourplugin/db/messages.php
https://docs.moodle.org/dev/Event_2
in
/local/yourpluginname/db/events.php
have something like
Add something like this to '/local/message/classes/observer.php'