Skip to content
Browse files

MDL-30698 forum: made message ID genuinely unique to prevent mail ser…

…vers dropping emails the look like duplicates
  • Loading branch information...
1 parent 0dde394 commit 1376b0ddf8e070268e154f54c78a81753bef4768 @andyjdavis andyjdavis committed Dec 14, 2011
Showing with 6 additions and 3 deletions.
  1. +6 −3 mod/forum/lib.php
View
9 mod/forum/lib.php
@@ -365,6 +365,9 @@ function forum_get_completion_state($course,$cm,$userid,$type) {
return $result;
}
+function forum_get_email_message_id($postid, $usertoid, $hostname) {
+ return '<moodlepost'.$postid.'to'.$usertoid.'@'.$hostname.'>';
+}
/**
* Function to be run periodically according to the moodle cron
@@ -603,14 +606,14 @@ function forum_cron() {
'Precedence: Bulk',
'List-Id: "'.$cleanforumname.'" <moodleforum'.$forum->id.'@'.$hostname.'>',
'List-Help: '.$CFG->wwwroot.'/mod/forum/view.php?f='.$forum->id,
- 'Message-ID: <moodlepost'.$post->id.'@'.$hostname.'>',
+ 'Message-ID: '.forum_get_email_message_id($post->id, $userto->id, $hostname),
'X-Course-Id: '.$course->id,
'X-Course-Name: '.format_string($course->fullname, true)
);
if ($post->parent) { // This post is a reply, so add headers for threading (see MDL-22551)
- $userfrom->customheaders[] = 'In-Reply-To: <moodlepost'.$post->parent.'@'.$hostname.'>';
- $userfrom->customheaders[] = 'References: <moodlepost'.$post->parent.'@'.$hostname.'>';
+ $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' => get_context_instance(CONTEXT_COURSE, $course->id)));

0 comments on commit 1376b0d

Please sign in to comment.
Something went wrong with that request. Please try again.