diff --git a/mod/forum/classes/task/send_user_notifications.php b/mod/forum/classes/task/send_user_notifications.php index 042b9bc330d..1190f66d1fc 100644 --- a/mod/forum/classes/task/send_user_notifications.php +++ b/mod/forum/classes/task/send_user_notifications.php @@ -485,6 +485,11 @@ class send_user_notifications extends \core\task\adhoc_task { } else { $headers[] = "References: $parentid"; } + } else { + // If the message IDs that Moodle creates are overwritten then referencing these + // IDs here will enable then to still thread correctly with the first email. + $headers[] = "In-Reply-To: $rootid"; + $headers[] = "References: $rootid"; } // MS Outlook / Office uses poorly documented and non standard headers, including