From 5d0cad42729f4343311572a46a72dca17e5c7d89 Mon Sep 17 00:00:00 2001 From: Martin Zimmermann Date: Sun, 13 Oct 2013 15:52:50 +0200 Subject: [PATCH] use proper email header encoding --- isso/notify.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/isso/notify.py b/isso/notify.py index 84d67ea..2b51c69 100644 --- a/isso/notify.py +++ b/isso/notify.py @@ -1,6 +1,7 @@ # -*- encoding: utf-8 -*- from smtplib import SMTP, SMTP_SSL +from email.header import Header from email.mime.text import MIMEText @@ -60,7 +61,7 @@ class SMTPMailer(object): msg = MIMEText(body, 'plain', 'utf-8') msg['From'] = "Ich schrei sonst! <%s>" % self.from_addr msg['To'] = self.to_addr - msg['Subject'] = subject.encode('utf-8') + msg['Subject'] = Header(subject, 'utf-8') with Connection(self.conf) as con: con.sendmail(self.from_addr, self.to_addr, msg.as_string())