Commit aad71919 authored by Jean-Paul Smets's avatar Jean-Paul Smets

Explicit UTF-8 support, send to each recipient one by one.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@16397 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent d6ca7ff3
...@@ -327,7 +327,7 @@ class EmailDocument(File, TextDocument): ...@@ -327,7 +327,7 @@ class EmailDocument(File, TextDocument):
body - a body message If not provided, we will body - a body message If not provided, we will
use the text representation of the event use the text representation of the event
as body as body (UTF-8)
attachment_format - defines an option format attachment_format - defines an option format
to convet attachments to (ex. application/pdf) to convet attachments to (ex. application/pdf)
...@@ -354,8 +354,8 @@ class EmailDocument(File, TextDocument): ...@@ -354,8 +354,8 @@ class EmailDocument(File, TextDocument):
if reply_url is None: if reply_url is None:
reply_url = self.portal_preferences.getPreferredEventSenderEmail() reply_url = self.portal_preferences.getPreferredEventSenderEmail()
if to_url is None: if to_url is None:
to_url = []
for recipient in self.getDestinationValueList(): for recipient in self.getDestinationValueList():
to_url = []
email = recipient.getDefaultEmailText() email = recipient.getDefaultEmailText()
if email: if email:
to_url.append(email) to_url.append(email)
...@@ -368,12 +368,12 @@ class EmailDocument(File, TextDocument): ...@@ -368,12 +368,12 @@ class EmailDocument(File, TextDocument):
message = MIMEMultipart() message = MIMEMultipart()
message['Subject'] = subject message['Subject'] = subject
message['From'] = from_url 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['Return-Path'] = reply_url
message.preamble = 'You will not see this in a MIME-aware mail reader.\n' message.preamble = 'You will not see this in a MIME-aware mail reader.\n'
# Add the body of the message # Add the body of the message
attached_message = MIMEText(str(body)) attached_message = MIMEText(str(body), _charset='UTF-8')
message.attach(attached_message) message.attach(attached_message)
# Attach files # Attach files
...@@ -409,7 +409,9 @@ class EmailDocument(File, TextDocument): ...@@ -409,7 +409,9 @@ class EmailDocument(File, TextDocument):
if download: if download:
return message.as_string() 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 ## Compatibility layer
#from Products.ERP5Type import Document #from Products.ERP5Type import Document
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment