mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 08:56:36 +02:00
Merge branch 'MDL-52997-email-threading' of https://github.com/brendanheywood/moodle
This commit is contained in:
commit
8bd2db2023
1 changed files with 24 additions and 6 deletions
|
@ -763,12 +763,6 @@ function forum_cron() {
|
||||||
'Auto-Submitted: auto-generated',
|
'Auto-Submitted: auto-generated',
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($post->parent) {
|
|
||||||
// This post is a reply, so add headers for threading (see MDL-22551).
|
|
||||||
$userfrom->customheaders[] = 'In-Reply-To: ' . forum_get_email_message_id($post->parent, $userto->id, $hostname);
|
|
||||||
$userfrom->customheaders[] = 'References: ' . forum_get_email_message_id($post->parent, $userto->id, $hostname);
|
|
||||||
}
|
|
||||||
|
|
||||||
$shortname = format_string($course->shortname, true, array('context' => context_course::instance($course->id)));
|
$shortname = format_string($course->shortname, true, array('context' => context_course::instance($course->id)));
|
||||||
|
|
||||||
// Generate a reply-to address from using the Inbound Message handler.
|
// Generate a reply-to address from using the Inbound Message handler.
|
||||||
|
@ -816,6 +810,30 @@ function forum_cron() {
|
||||||
$a->courseshortname = $data->get_coursename();
|
$a->courseshortname = $data->get_coursename();
|
||||||
$postsubject = html_to_text(get_string('postmailsubject', 'forum', $a), 0);
|
$postsubject = html_to_text(get_string('postmailsubject', 'forum', $a), 0);
|
||||||
|
|
||||||
|
$rootid = forum_get_email_message_id($discussion->firstpost, $userto->id, $hostname);
|
||||||
|
|
||||||
|
if ($post->parent) {
|
||||||
|
// This post is a reply, so add reply header (RFC 2822).
|
||||||
|
$parentid = forum_get_email_message_id($post->parent, $userto->id, $hostname);
|
||||||
|
$userfrom->customheaders[] = "In-Reply-To: $parentid";
|
||||||
|
|
||||||
|
// If the post is deeply nested we also reference the parent message id and
|
||||||
|
// the root message id (if different) to aid threading when parts of the email
|
||||||
|
// conversation have been deleted (RFC1036).
|
||||||
|
if ($post->parent != $discussion->firstpost) {
|
||||||
|
$userfrom->customheaders[] = "References: $rootid $parentid";
|
||||||
|
} else {
|
||||||
|
$userfrom->customheaders[] = "References: $parentid";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// MS Outlook / Office uses poorly documented and non standard headers, including
|
||||||
|
// Thread-Topic which overrides the Subject and shouldn't contain Re: or Fwd: etc.
|
||||||
|
$a->subject = $discussion->name;
|
||||||
|
$postsubject = html_to_text(get_string('postmailsubject', 'forum', $a), 0);
|
||||||
|
$userfrom->customheaders[] = "Thread-Topic: $postsubject";
|
||||||
|
$userfrom->customheaders[] = "Thread-Index: " . substr($rootid, 1, 28);
|
||||||
|
|
||||||
// Send the post now!
|
// Send the post now!
|
||||||
mtrace('Sending ', '');
|
mtrace('Sending ', '');
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue