public static function message_viewed(\core\event\message_viewed $event) {
        global $DB;

        $userid = $event->userid;
        $messageid = $event->other['messageid'];

        $DB->delete_records('message_email_messages', ['useridto' => $userid, 'messageid' => $messageid]);
    }