Help with sending e-mails from Moodle (Moodle 2.6 version)

Help with sending e-mails from Moodle (Moodle 2.6 version)

Daniel Lozano
Vastuste arv 0
Hi everyone!

If someone could, i'm going to explain my problem. I didn't find it anywhere. Thanks in advance!

I'm programming a module in Moodle where a student can reserve a tutorship with a professor.

I have a little form where the student says the date and the motive of the tutorship. Also I put a button to send the request.

What i want to do is to send a message to both, professor and student which confirm the reservation.

I have tried to see how Moodle send an email when the admin send a message to a student, but I cannot replicate it to my module.

I have seen this help provided by Moodle, I tried it but with no result:
https://docs.moodle.org/dev/Message_API

I am going to upload my code to you to see if someone could help me with this.

I hope you could help me because i didn't see anything about this in this forum and i don't know where to find some help.

In the code you will see that i am trying to send the message after press the 'save' button, between lines 44 and 72.

What can i doing wrong? And yes, i have the option to send emails from the admin activated because i've tried to send a message from the admin to a user succesfully.

Thanks a lot!


Keskmine hinnang: -