[Erp5-report] r16397 - /erp5/trunk/products/ERP5/Document/EmailDocument.py

nobody at svn.erp5.org nobody at svn.erp5.org
Mon Sep 17 01:19:52 CEST 2007


Author: jp
Date: Mon Sep 17 01:19:52 2007
New Revision: 16397

URL: http://svn.erp5.org?rev=16397&view=rev
Log:
Explicit UTF-8 support, send to each recipient one by one.

Modified:
    erp5/trunk/products/ERP5/Document/EmailDocument.py

Modified: erp5/trunk/products/ERP5/Document/EmailDocument.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/EmailDocument.py?rev=16397&r1=16396&r2=16397&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/EmailDocument.py (original)
+++ erp5/trunk/products/ERP5/Document/EmailDocument.py Mon Sep 17 01:19:52 2007
@@ -327,7 +327,7 @@
 
       body     - a body message If not provided, we will
                  use the text representation of the event
-                 as body
+                 as body (UTF-8)
 
       attachment_format - defines an option format
                  to convet attachments to (ex. application/pdf)
@@ -354,8 +354,8 @@
     if reply_url is None:
       reply_url = self.portal_preferences.getPreferredEventSenderEmail()
     if to_url is None:
+      to_url = []
       for recipient in self.getDestinationValueList():
-        to_url = []
         email = recipient.getDefaultEmailText()
         if email:
           to_url.append(email)
@@ -368,12 +368,12 @@
     message = MIMEMultipart()
     message['Subject'] = subject
     message['From'] = from_url
-    message['To'] = COMMASPACE.join(to_url)
+    message['To'] = from_url # Use this temporarily - we send messages one by one
     message['Return-Path'] = reply_url
     message.preamble = 'You will not see this in a MIME-aware mail reader.\n'
 
     # Add the body of the message
-    attached_message = MIMEText(str(body))
+    attached_message = MIMEText(str(body), _charset='UTF-8')
     message.attach(attached_message)
 
     # Attach files
@@ -409,7 +409,9 @@
     if download:
       return message.as_string()
 
-    self.MailHost.send(message.as_string())
+    for recipient in to_url:
+      message['To'] = recipient
+      self.MailHost.send(message.as_string())
 
 ## Compatibility layer
 #from Products.ERP5Type import Document




More information about the Erp5-report mailing list