summaryrefslogtreecommitdiffstats
path: root/wallace
diff options
context:
space:
mode:
authorAleksander Machniak <machniak@kolabsys.com>2016-04-04 16:22:39 +0200
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2016-04-04 16:22:39 +0200
commit49b207d5f3ff366a4f9d43548a791421e9b5b962 (patch)
tree3c50a33f8b22d3a389ab80f332ad498e6119908b /wallace
parent79643df67b4a102da9e71b0dd7addf85b832da92 (diff)
downloadpykolab-49b207d5f3ff366a4f9d43548a791421e9b5b962.tar.gz
Fix From header encoding in invitation notifications (#4258)
Summary: Fixes https://issues.kolab.org/show_bug.cgi?id=4258 Reviewers: #pykolab_developers, vanmeeuwen Reviewed By: #pykolab_developers, vanmeeuwen Differential Revision: https://git.kolab.org/D120
Diffstat (limited to 'wallace')
-rw-r--r--wallace/module_invitationpolicy.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/wallace/module_invitationpolicy.py b/wallace/module_invitationpolicy.py
index 152a9e7..9865d71 100644
--- a/wallace/module_invitationpolicy.py
+++ b/wallace/module_invitationpolicy.py
@@ -1109,9 +1109,10 @@ def send_update_notification(object, receiving_user, old=None, reply=True):
import smtplib
from email.MIMEText import MIMEText
from email.Utils import formatdate
+ from email.header import Header
+ from email import charset
# encode unicode strings with quoted-printable
- from email import charset
charset.add_charset('utf-8', charset.SHORTEST, charset.QP)
organizer = object.get_organizer()
@@ -1205,7 +1206,8 @@ def send_update_notification(object, receiving_user, old=None, reply=True):
msg['To'] = receiving_user['mail']
msg['Date'] = formatdate(localtime=True)
msg['Subject'] = utils.str2unicode(_('"%s" has been updated') % (object.get_summary()))
- msg['From'] = utils.str2unicode('"%s" <%s>' % (orgname, orgemail) if orgname else orgemail)
+ msg['From'] = Header(utils.str2unicode('%s' % orgname) if orgname else '')
+ msg['From'].append("<%s>" % orgemail)
smtp = smtplib.SMTP("localhost", 10027)
@@ -1237,9 +1239,10 @@ def send_cancel_notification(object, receiving_user, deleted=False):
import smtplib
from email.MIMEText import MIMEText
from email.Utils import formatdate
+ from email.header import Header
+ from email import charset
# encode unicode strings with quoted-printable
- from email import charset
charset.add_charset('utf-8', charset.SHORTEST, charset.QP)
log.debug(_("Send cancellation notification for %s %r to user %r") % (
@@ -1279,7 +1282,8 @@ def send_cancel_notification(object, receiving_user, deleted=False):
msg['To'] = receiving_user['mail']
msg['Date'] = formatdate(localtime=True)
msg['Subject'] = utils.str2unicode(_('"%s" has been cancelled') % (object.get_summary()))
- msg['From'] = utils.str2unicode('"%s" <%s>' % (orgname, orgemail) if orgname else orgemail)
+ msg['From'] = Header(utils.str2unicode('%s' % orgname) if orgname else '')
+ msg['From'].append("<%s>" % orgemail)
smtp = smtplib.SMTP("localhost", 10027)