protected function add_message_header() {
        $site = get_site();

        // Set the subject of the message.
        $this->postsubject = get_string('digestmailsubject', 'forum', format_string($site->shortname, true));

        // And the content of the header in body.
        $headerdata = (object) [
            'sitename' => format_string($site->fullname, true),
            'userprefs' => (new \moodle_url('/user/forum.php', [
                    'id' => $this->recipient->id,
                    'course' => $site->id,
                ]))->out(false),
            ];

        $this->notificationtext .= get_string('digestmailheader', 'forum', $headerdata) . "\n";

        if ($this->allowhtml) {
            $headerdata->userprefs = html_writer::link($headerdata->userprefs, get_string('digestmailprefs', 'forum'), [
                    'target' => '_blank',
                ]);

            $this->notificationhtml .= html_writer::tag('p', get_string('digestmailheader', 'forum', $headerdata));
            $this->notificationhtml .= html_writer::empty_tag('br');
            $this->notificationhtml .= html_writer::empty_tag('hr', [
                    'size' => 1,
                    'noshade' => 'noshade',
                ]);
        }
    }