How to send email

How to send email

by Lorenzzo Mollinar -
Number of replies: 1

Hello everyone,

We built a block to record callings support within Moodle, would like to implement the option to receive an email notification when a new call is opened and the user will also receive an email when I change the status of your call, it would be an e-mail notification like that we received when we have new message.

Thank you for your help.

Average of ratings: -
In reply to Lorenzzo Mollinar

Re: How to send email

by Mark Johnson -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Hi Lorenzzo,

Very simply, there's a function called email_to_user() which you can call to send an email to a user.  However, the better way to do this is to use Moodle's Message API to generate your message which will then be sent to the user via their preferred method (including email).