From 190820a89bc96a7824773ece12a0da65c39ad89f Mon Sep 17 00:00:00 2001
From: Julien Muchembled <jm@nexedi.com>
Date: Fri, 12 Aug 2011 17:56:54 +0200
Subject: [PATCH] NotificationTool: do not add empty Subject:; To: or From:
 fields

We might want to rely on MailHost for filling those fields.
---
 product/ERP5/Tool/NotificationTool.py | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/product/ERP5/Tool/NotificationTool.py b/product/ERP5/Tool/NotificationTool.py
index f6c1b10355..e16d5b4289 100644
--- a/product/ERP5/Tool/NotificationTool.py
+++ b/product/ERP5/Tool/NotificationTool.py
@@ -134,10 +134,13 @@ def buildEmailMessage(from_url, to_url, msg=None,
     for key, value in additional_headers.items():
       message.add_header(key, value)
 
-  message.add_header('Subject',
-                      make_header([(subject, 'utf-8')]).encode())
-  message.add_header('From', from_url)
-  message.add_header('To', to_url)
+  if subject:
+    message.add_header('Subject',
+                        make_header([(subject, 'utf-8')]).encode())
+  if from_url:
+    message.add_header('From', from_url)
+  if to_url:
+    message.add_header('To', to_url)
 
   for attachment in attachment_list:
     attachment_name = attachment.get('name', '')
-- 
2.30.9