From ce53689569b4eb3527611b1b1642f3c423d67ea2 Mon Sep 17 00:00:00 2001
From: Romain Courteaud <romain@nexedi.com>
Date: Tue, 29 Mar 2011 09:21:48 +0000
Subject: [PATCH] Generate Message-ID header, in order to prevent the MTA to
 generate it later and so, store the information into ERP5 to be able to keep
 mail threading.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@44711 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5Type/patches/MailTemplates.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/product/ERP5Type/patches/MailTemplates.py b/product/ERP5Type/patches/MailTemplates.py
index 7767e979b8..714929dbc2 100644
--- a/product/ERP5Type/patches/MailTemplates.py
+++ b/product/ERP5Type/patches/MailTemplates.py
@@ -16,6 +16,7 @@ except ImportError:
   BaseMailTemplate = None
 
 from email.Header import make_header
+from email.utils import make_msgid
 
 if BaseMailTemplate is not None:
   def _process_utf8(self,kw):
@@ -80,6 +81,8 @@ if BaseMailTemplate is not None:
               ))
       # add date header
       headers['Date']=BaseMailTemplate.DateTime().rfc822()
+      # add message-id header
+      headers['Message-ID']=make_msgid()
       # turn headers into an ordered list for predictable header order
       keys = headers.keys()
       keys.sort()
-- 
2.30.9