diff --git a/lib/classes/message/manager.php b/lib/classes/message/manager.php
index 774a5907180..449d73b2d47 100644
--- a/lib/classes/message/manager.php
+++ b/lib/classes/message/manager.php
@@ -357,6 +357,8 @@ class manager {
             return $savemessage->id;
         }
 
+        $eventdata->notificationobject = $savemessage;
+        
         // Send the message to processors.
         self::call_processors($eventdata, $processorlist);
 
diff --git a/lib/classes/message/message.php b/lib/classes/message/message.php
index 27e2edfcb32..aeceeee7525 100644
--- a/lib/classes/message/message.php
+++ b/lib/classes/message/message.php
@@ -137,6 +137,7 @@ class message {
         'fullmessagehtml',
         'smallmessage',
         'notification',
+        'notificationobject',
         'contexturl',
         'contexturlname',
         'replyto',
@@ -283,6 +284,14 @@ class message {
         $this->additionalcontent[$processorname] = $content;
     }
 
+    public function get_notificationobject($processorname) {
+        if (!empty($processorname) && isset($this->additionalcontent[$processorname])) {
+            return $this->get_message_with_additional_content($processorname, 'notificationobject');
+        } else {
+            return property_exists($this, 'notificationobject') ? $this->notificationobject : null;
+        }
+    }
+
     /**
      * Get a event object for a specific processor in stdClass format.
      *
diff --git a/message/output/email/message_output_email.php b/message/output/email/message_output_email.php
index 96536ec5d89..337d4380493 100644
--- a/message/output/email/message_output_email.php
+++ b/message/output/email/message_output_email.php
@@ -93,7 +93,13 @@ class message_output_email extends message_output {
         $result = email_to_user($recipient, $eventdata->userfrom, $eventdata->subject, $eventdata->fullmessage,
                                 $eventdata->fullmessagehtml, $attachment, $attachname, true, $replyto, $replytoname);
 
-        if ($result && $notification = $DB->get_record('notifications', ['id' => $eventdata->savedmessageid])) {
+        $notification = $eventdata->notificationobject ? $eventdata->notificationobject
+            : $DB->get_record('notifications', ['id' => $eventdata->savedmessageid]);
+        if (!property_exists($notification, 'timeread')) {
+            $notification->timeread = null;
+        }
+
+        if ($result && $notification) {
             \core_message\api::mark_notification_as_read($notification);
         }
 
