From ba657ff6963a4f97568b63b76feb3a85eae39f61 Mon Sep 17 00:00:00 2001
From: Jean-Paul Smets <jp@nexedi.com>
Date: Sat, 9 Feb 2008 14:16:06 +0000
Subject: [PATCH] Improved usage of portal default properties for from email
 and to email. Some space added for better syntax.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@19204 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5/Tool/NotificationTool.py | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/product/ERP5/Tool/NotificationTool.py b/product/ERP5/Tool/NotificationTool.py
index 7fe87cb779..19ec2e59a1 100644
--- a/product/ERP5/Tool/NotificationTool.py
+++ b/product/ERP5/Tool/NotificationTool.py
@@ -165,7 +165,8 @@ class NotificationTool(BaseTool):
 
     # Default Values
     portal = self.getPortalObject()
-    default_email = portal.email_from_address
+    default_from_email = portal.email_from_address
+    default_to_email = portal.email_to_address
 
     # Change all strings to object values
     if isinstance(sender, basestring):
@@ -179,7 +180,7 @@ class NotificationTool(BaseTool):
     if not email_from_address:
       # If we can not find a from address then
       # we fallback to default values
-      email_from_address = default_email
+      email_from_address = default_from_email
 
     # To is a list - let us find all members
     if not isinstance(recipient, (list, tuple)):
@@ -191,10 +192,10 @@ class NotificationTool(BaseTool):
       mailhost = getattr(self.getPortalObject(), 'MailHost', None)
       if mailhost is None:
         raise AttributeError, "Cannot find a MailHost object"
-      mail_message = buildEmailMessage(email_from_address, default_email, 
+      mail_message = buildEmailMessage(email_from_address, default_to_email, 
                                        msg=message, subject=subject,
                                        attachment_list=attachment_list)
-      return mailhost.send(mail_message.as_string(), default_email, email_from_address)
+      return mailhost.send(mail_message.as_string(), default_to_email, email_from_address)
 
     # Default implementation is to send an active message to everyone
     for person in recipient:
-- 
2.30.9