* Send out emails.
*/
public function execute() {
- global $DB, $PAGE;
+ global $DB, $PAGE, $SITE;
// Get the maximum id we are going to use.
// We use this as records may be added to the table while this task runs.
}
$conversations->close();
if ($hascontent) {
- $subject = get_string('emaildigestsubject', 'message_email');
+ $subject = get_string('messagedigestemailsubject', 'message_email', format_string($SITE->fullname));
$message = $textrenderer->render($renderable);
$messagehtml = $htmlrenderer->render($renderable);
if (email_to_user($user, $noreplyuser, $subject, $message, $messagehtml)) {
$string['emaildigestviewallmessages'] = 'View all messages';
$string['emailonlyfromnoreplyaddress'] = 'Always send email from the no-reply address?';
$string['ifemailleftempty'] = 'Leave empty to send notifications to {$a}';
+$string['messagedigestemailsubject'] = '{$a}: Messages digest';
$string['pluginname'] = 'Email';
$string['privacy:metadata:attachment'] = 'A file on the filesystem.';
$string['privacy:metadata:attachname'] = 'The name of the attached file (extension indicates MIME).';
* Test sending email task.
*/
public function test_sending_email_task() {
- global $DB;
+ global $DB, $SITE;
$this->preventResetByRollback(); // Messaging is not compatible with transactions.
// Confirm it contains the correct data.
$emails = $sink->get_messages();
$email = reset($emails);
- $this->assertSame(get_string('emaildigestsubject', 'message_email'), $email->subject);
+ $sitename = format_string($SITE->fullname);
+ $this->assertSame(get_string('messagedigestemailsubject', 'message_email', $sitename), $email->subject);
$this->assertSame($user2->email, $email->to);
$this->assertNotEmpty($email->header);
$emailbody = quoted_printable_decode($email->body);