diff --git a/roundup/mailer.py b/roundup/mailer.py
index 453a1ded0ed45c614eba34d5414bb0c6080e374a..f1a1af3bdf45a20f469dd7132b022449cf922df1 100644 (file)
--- a/roundup/mailer.py
+++ b/roundup/mailer.py
charset = getattr(self.config, 'EMAIL_CHARSET', 'utf-8')
tracker_name = unicode(self.config.TRACKER_NAME, 'utf-8')
if not author:
- author = formataddr((tracker_name, self.config.ADMIN_EMAIL))
+ author = (tracker_name, self.config.ADMIN_EMAIL)
+ name = author[0]
else:
name = unicode(author[0], 'utf-8')
- author = formataddr((name, author[1]))
+ try:
+ name = name.encode('ascii')
+ except UnicodeError:
+ name = Header(name, charset).encode()
+ author = formataddr((name, author[1]))
if multipart:
message = MIMEMultipart()
except UnicodeError:
message['Subject'] = Header(subject, charset)
message['To'] = ', '.join(to)
- try:
- message['From'] = author.encode('ascii')
- except UnicodeError:
- message['From'] = Header(author, charset)
+ message['From'] = author
message['Date'] = formatdate(localtime=True)
# add a Precedence header so autoresponders ignore us