Changed ietf/utils/mail.py to use unicode strings, and changed a call in ietf/reviv/utils.py to use unicode for mail Subject, to fix a server 500 issue.

- Legacy-Id: 16007
This commit is contained in:
Henrik Levkowetz 2019-03-06 16:57:00 +00:00
parent 17824652cb
commit 8a669909bc
2 changed files with 7 additions and 2 deletions

View file

@ -1,3 +1,8 @@
# -*- coding: utf-8 -*-
# Copyright The IETF Trust 2016-2019, All Rights Reserved
from __future__ import unicode_literals, print_function
import datetime, re, itertools
from collections import defaultdict, namedtuple

View file

@ -117,7 +117,7 @@ def send_smtp(msg, bcc=None):
raise SMTPSomeRefusedRecipients(message="%d addresses were refused"%len(unhandled),original_msg=msg,refusals=unhandled)
except Exception as e:
# need to improve log message
log("Exception while trying to send email from '%s' to %s subject '%s'" % (frm, to, msg.get('Subject', '[no subject]')))
log(u"Exception while trying to send email from '%s' to %s subject '%s'" % (frm, to, msg.get('Subject', '[no subject]')))
if isinstance(e, smtplib.SMTPException):
e.original_msg=msg
raise
@ -128,7 +128,7 @@ def send_smtp(msg, bcc=None):
server.quit()
except smtplib.SMTPServerDisconnected:
pass
log("sent email from '%s' to %s id %s subject '%s'" % (frm, to, msg.get('Message-ID', ''), msg.get('Subject', '[no subject]')))
log(u"sent email from '%s' to %s id %s subject '%s'" % (frm, to, msg.get('Message-ID', ''), msg.get('Subject', '[no subject]')))
def copy_email(msg, to, toUser=False, originalBcc=None):
'''