Index: lnt/trunk/lnt/lnttool/main.py =================================================================== --- lnt/trunk/lnt/lnttool/main.py +++ lnt/trunk/lnt/lnttool/main.py @@ -269,7 +269,7 @@ % (config.zorgURL, database, testsuite) subject = "Daily Report: %04d-%02d-%02d" % ( report.year, report.month, report.day) - html_report = report.render(ts_url, only_html_body=False) + html_report = report.render(ts_url, only_html_body=False).encode('utf-8') if subject_prefix is not None: subject = "%s %s" % (subject_prefix, subject) @@ -279,7 +279,7 @@ msg['Subject'] = subject msg['From'] = from_address msg['To'] = address - msg.attach(email.mime.text.MIMEText(html_report, "html")) + msg.attach(email.mime.text.MIMEText(html_report, 'html', 'utf-8')) # Send the report. if not dry_run: @@ -354,9 +354,9 @@ env = lnt.server.ui.app.create_jinja_environment() text_template = env.get_template('reporting/run_report.txt') - text_report = text_template.render(data) + text_report = text_template.render(data).encode('utf-8') html_template = env.get_template('reporting/run_report.html') - html_report = html_template.render(data) + html_report = html_template.render(data).encode('utf-8') subject = data['subject'] if subject_prefix is not None: @@ -367,8 +367,8 @@ msg['Subject'] = subject msg['From'] = from_address msg['To'] = to_address - msg.attach(email.mime.text.MIMEText(text_report, 'plain')) - msg.attach(email.mime.text.MIMEText(html_report, 'html')) + msg.attach(email.mime.text.MIMEText(text_report, 'plain', 'utf-8')) + msg.attach(email.mime.text.MIMEText(html_report, 'html', 'utf-8')) # Send the report. if not dry_run: Index: lnt/trunk/lnt/util/NTEmailReport.py =================================================================== --- lnt/trunk/lnt/util/NTEmailReport.py +++ lnt/trunk/lnt/util/NTEmailReport.py @@ -23,7 +23,7 @@ # Generate a plain text message if we have no html report. if not html_report: - msg = email.mime.text.MIMEText(report) + msg = email.mime.text.MIMEText(report.encode('utf-8'), 'plain', 'utf-8') msg['Subject'] = subject msg['From'] = email_config.from_address msg['To'] = to @@ -36,8 +36,8 @@ # Attach parts into message container, according to RFC 2046, the last # part of a multipart message, in this case the HTML message, is best # and preferred. - msg.attach(email.mime.text.MIMEText(report, 'plain')) - msg.attach(email.mime.text.MIMEText(html_report, 'html')) + msg.attach(email.mime.text.MIMEText(report.encode('utf-8'), 'plain', 'utf-8')) + msg.attach(email.mime.text.MIMEText(html_report.encode('utf-8'), 'html', 'utf-8')) s = smtplib.SMTP(email_config.host) s.sendmail(email_config.from_address, [to], msg.as_string())