fix send email feature: encode subject and message correctly
git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@3710 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
parent
0d8be13807
commit
d70b5e5d44
2 changed files with 3 additions and 4 deletions
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# Copyright (c) 2007 Helmut Merz helmutm@cy55.de
|
||||
# Copyright (c) 2010 Helmut Merz helmutm@cy55.de
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
@ -123,7 +123,6 @@ def decodeHeader(h):
|
|||
result.append(v)
|
||||
return ''.join(result)
|
||||
|
||||
|
||||
def getPayload(msg):
|
||||
parts = {}
|
||||
for msg in msg.walk():
|
||||
|
|
|
@ -156,8 +156,8 @@ class SendEmail(FormController):
|
|||
recipients += (form.get('addrRecipients') or u'').split('\n')
|
||||
person = getPersonForUser(self.context, self.request)
|
||||
sender = person and adapted(person).email or 'loops@unknown.com'
|
||||
msg = MIMEText(message, 'plain', 'utf-8')
|
||||
msg['Subject'] = subject
|
||||
msg = MIMEText(message.encode('utf-8'), 'plain', 'utf-8')
|
||||
msg['Subject'] = subject.encode('utf-8')
|
||||
msg['From'] = sender
|
||||
msg['To'] = ', '.join(r.strip() for r in recipients if r.strip())
|
||||
mailhost = component.getUtility(IMailDelivery, 'Mail')
|
||||
|
|
Loading…
Add table
Reference in a new issue